Merge pull request #3129 from dumganhar/iss2395-s9sprite-test

closed 2395: Adding Scale9SpriteTest for TestCpp
This commit is contained in:
James Chen 2013-07-11 00:30:20 -07:00
commit 103b184be0
13 changed files with 837 additions and 67 deletions

View File

@ -96,8 +96,9 @@ bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bool
if(batchnode) if(batchnode)
{ {
this->updateWithBatchNode(batchnode, rect, rotated, capInsets); this->updateWithBatchNode(batchnode, rect, rotated, capInsets);
this->setAnchorPoint(ccp(0.5f, 0.5f));
} }
this->setAnchorPoint(ccp(0.5f, 0.5f));
this->_positionsAreDirty = true; this->_positionsAreDirty = true;
return true; return true;

View File

@ -66,6 +66,7 @@ Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp \
Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp \ Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp \
Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \ Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \
Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \ Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \
Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
Classes/FontTest/FontTest.cpp \ Classes/FontTest/FontTest.cpp \
Classes/IntervalTest/IntervalTest.cpp \ Classes/IntervalTest/IntervalTest.cpp \
Classes/KeypadTest/KeypadTest.cpp \ Classes/KeypadTest/KeypadTest.cpp \
@ -110,6 +111,8 @@ Classes/AppDelegate.cpp \
Classes/BaseTest.cpp \ Classes/BaseTest.cpp \
Classes/VisibleRect.cpp Classes/VisibleRect.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static

View File

@ -8,53 +8,6 @@
USING_NS_CC; USING_NS_CC;
enum
{
ACTION_MANUAL_LAYER = 0,
ACTION_MOVE_LAYER,
ACTION_SCALE_LAYER,
ACTION_ROTATE_LAYER,
ACTION_SKEW_LAYER,
ACTION_ROTATIONAL_SKEW_LAYER,
ACTION_ROTATIONAL_SKEW_VS_STANDARD_SKEW_LAYER,
ACTION_SKEWROTATE_LAYER,
ACTION_JUMP_LAYER,
ACTION_CARDINALSPLINE_LAYER,
ACTION_CATMULLROM_LAYER,
ACTION_BEZIER_LAYER,
ACTION_BLINK_LAYER,
ACTION_FADE_LAYER,
ACTION_TINT_LAYER,
ACTION_ANIMATE_LAYER,
ACTION_SEQUENCE_LAYER,
ACTION_SEQUENCE2_LAYER,
ACTION_SPAWN_LAYER,
ACTION_REVERSE,
ACTION_DELAYTIME_LAYER,
ACTION_REPEAT_LAYER,
ACTION_REPEATEFOREVER_LAYER,
ACTION_ROTATETOREPEATE_LAYER,
ACTION_ROTATEJERK_LAYER,
ACTION_CALLFUNC_LAYER,
ACTION_CALLFUNCND_LAYER,
ACTION_CALLFUNCTION_LAYER,
ACTION_REVERSESEQUENCE_LAYER,
ACTION_REVERSESEQUENCE2_LAYER,
ACTION_ORBIT_LAYER,
ACTION_FLLOW_LAYER,
ACTION_TARGETED_LAYER,
PAUSERESUMEACTIONS_LAYER,
ACTION_ISSUE1305_LAYER,
ACTION_ISSUE1305_2_LAYER,
ACTION_ISSUE1288_LAYER,
ACTION_ISSUE1288_2_LAYER,
ACTION_ISSUE1327_LAYER,
ACTION_ISSUE1398_LAYER,
ACTION_LAYER_COUNT,
ACTION_REMOVE_SELF,
};
// the class inherit from TestScene // the class inherit from TestScene
// every Scene each test used must inherit from TestScene, // every Scene each test used must inherit from TestScene,
// make sure the test have the menu item for back to main menu // make sure the test have the menu item for back to main menu

View File

@ -18,6 +18,8 @@
#include "EditBoxTest/EditBoxTest.h" #include "EditBoxTest/EditBoxTest.h"
#endif #endif
#include "Scale9SpriteTest/Scale9SpriteTest.h"
enum enum
{ {
LINE_SPACE = 40, LINE_SPACE = 40,
@ -30,6 +32,15 @@ static struct {
} g_extensionsTests[] = { } g_extensionsTests[] = {
{ "NotificationCenterTest", [](Object* sender) { runNotificationCenterTest(); } { "NotificationCenterTest", [](Object* sender) { runNotificationCenterTest(); }
}, },
{ "Scale9SpriteTest", [](Object* sender) {
S9SpriteTestScene* pScene = new S9SpriteTestScene();
if (pScene)
{
pScene->runThisTest();
pScene->release();
}
}
},
{ "CCControlButtonTest", [](Object *sender){ { "CCControlButtonTest", [](Object *sender){
ControlSceneManager* pManager = ControlSceneManager::sharedControlSceneManager(); ControlSceneManager* pManager = ControlSceneManager::sharedControlSceneManager();
Scene* pScene = pManager->currentControlScene(); Scene* pScene = pManager->currentControlScene();

View File

@ -0,0 +1,603 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013 Surith Thekkiam
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "Scale9SpriteTest.h"
#include "testResource.h"
#include "cocos2d.h"
#include "cocos-ext.h"
USING_NS_CC_EXT;
static std::function<Layer*()> createFunctions[] = {
CL(S9BatchNodeBasic),
CL(S9FrameNameSpriteSheet),
CL(S9FrameNameSpriteSheetRotated),
CL(S9BatchNodeScaledNoInsets),
CL(S9FrameNameSpriteSheetScaledNoInsets),
CL(S9FrameNameSpriteSheetRotatedScaledNoInsets),
CL(S9BatchNodeScaleWithCapInsets),
CL(S9FrameNameSpriteSheetInsets),
CL(S9FrameNameSpriteSheetInsetsScaled),
CL(S9FrameNameSpriteSheetRotatedInsets),
CL(S9_TexturePacker),
CL(S9FrameNameSpriteSheetRotatedInsetsScaled)
};
static int sceneIdx=-1;
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
static Layer* nextAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
return pLayer;
}
static Layer* backAction()
{
sceneIdx--;
int total = MAX_LAYER;
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
return pLayer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
return pLayer;
}
void S9SpriteTestScene::runThisTest()
{
sceneIdx = -1;
addChild(nextAction());
Director::sharedDirector()->replaceScene(this);
}
//------------------------------------------------------------------
//
// S9SpriteTestDemo
//
//------------------------------------------------------------------
void S9SpriteTestDemo::onEnter()
{
BaseTest::onEnter();
SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(s_s9s_blocks9_plist);
CCLOG("sprite frames added to sprite frame cache...");
}
void S9SpriteTestDemo::restartCallback(Object* sender)
{
Scene* s = new S9SpriteTestScene();
s->addChild( restartAction() );
Director::sharedDirector()->replaceScene(s);
s->release();
}
void S9SpriteTestDemo::nextCallback(Object* sender)
{
Scene* s = new S9SpriteTestScene();
s->addChild( nextAction() );
Director::sharedDirector()->replaceScene(s);
s->release();
}
void S9SpriteTestDemo::backCallback(Object* sender)
{
Scene* s = new S9SpriteTestScene();
s->addChild( backAction() );
Director::sharedDirector()->replaceScene(s);
s->release();
}
// S9BatchNodeBasic
void S9BatchNodeBasic::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeBasic ...");
auto batchNode = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode created with : Images/blocks9.png");
auto blocks = Scale9Sprite::create();
CCLog("... created");
blocks->updateWithBatchNode(batchNode, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
CCLog("... updateWithBatchNode");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
CCLog("... S9BatchNodeBasic done.");
}
std::string S9BatchNodeBasic::title()
{
return "Scale9Sprite created empty and updated from SpriteBatchNode";
}
std::string S9BatchNodeBasic::subtitle()
{
return "updateWithBatchNode(); capInsets=full size";
}
// S9FrameNameSpriteSheet
void S9FrameNameSpriteSheet::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheet ...");
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
CCLog("... created");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheet done.");
}
std::string S9FrameNameSpriteSheet::title()
{
return "Scale9Sprite from sprite sheet";
}
std::string S9FrameNameSpriteSheet::subtitle()
{
return "createWithSpriteFrameName(); default cap insets";
}
//
//// S9FrameNameSpriteSheetRotated
//
void S9FrameNameSpriteSheetRotated::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotated ...");
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotated done.");
}
std::string S9FrameNameSpriteSheetRotated::title()
{
return "Scale9Sprite from sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotated::subtitle()
{
return "createWithSpriteFrameName(); default cap insets";
}
//
//// S9BatchNodeScaledNoInsets
//
void S9BatchNodeScaledNoInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeScaledNoInsets ...");
// scaled without insets
auto batchNode_scaled = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode_scaled created with : Images/blocks9.png");
auto blocks_scaled = Scale9Sprite::create();
CCLog("... created");
blocks_scaled->updateWithBatchNode(batchNode_scaled, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
CCLog("... updateWithBatchNode");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
CCLog("... S9BtchNodeScaledNoInsets done.");
}
std::string S9BatchNodeScaledNoInsets::title()
{
return "Scale9Sprite created empty and updated from SpriteBatchNode";
}
std::string S9BatchNodeScaledNoInsets::subtitle()
{
return "updateWithBatchNode(); capInsets=full size; rendered 4 X width, 2 X height";
}
//
//// S9FrameNameSpriteSheetScaledNoInsets
//
void S9FrameNameSpriteSheetScaledNoInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetScaledNoInsets ...");
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
CCLog("... created");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetScaledNoInsets done.");
}
std::string S9FrameNameSpriteSheetScaledNoInsets::title()
{
return "Scale9Sprite from sprite sheet";
}
std::string S9FrameNameSpriteSheetScaledNoInsets::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered 4 X width, 2 X height";
}
//
//// S9FrameNameSpriteSheetRotatedScaledNoInsets
//
void S9FrameNameSpriteSheetRotatedScaledNoInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
}
std::string S9FrameNameSpriteSheetRotatedScaledNoInsets::title()
{
return "Scale9Sprite from sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotatedScaledNoInsets::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered 4 X width, 2 X height";
}
//
//
//// S9BatchNodeScaleWithCapInsets
//
void S9BatchNodeScaleWithCapInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeScaleWithCapInsets ...");
auto batchNode_scaled_with_insets = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode_scaled_with_insets created with : Images/blocks9.png");
auto blocks_scaled_with_insets = Scale9Sprite::create();
CCLog("... created");
blocks_scaled_with_insets->updateWithBatchNode(batchNode_scaled_with_insets, Rect(0, 0, 96, 96), false, Rect(32, 32, 32, 32));
CCLog("... updateWithBatchNode");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
CCLog("... S9BatchNodeScaleWithCapInsets done.");
}
std::string S9BatchNodeScaleWithCapInsets::title()
{
return "Scale9Sprite created empty and updated from SpriteBatchNode";
}
std::string S9BatchNodeScaleWithCapInsets::subtitle()
{
return "updateWithBatchNode(); capInsets=(32, 32, 32, 32)";
}
//
//// S9FrameNameSpriteSheetInsets
//
void S9FrameNameSpriteSheetInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetInsets ...");
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetInsets done.");
}
std::string S9FrameNameSpriteSheetInsets::title()
{
return "Scale9Sprite scaled with insets sprite sheet";
}
std::string S9FrameNameSpriteSheetInsets::subtitle()
{
return "createWithSpriteFrameName(); cap insets=(32, 32, 32, 32)";
}
//
//// S9FrameNameSpriteSheetInsetsScaled
//
void S9FrameNameSpriteSheetInsetsScaled::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetInsetsScaled ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetInsetsScaled done.");
}
std::string S9FrameNameSpriteSheetInsetsScaled::title()
{
return "Scale9Sprite scaled with insets sprite sheet";
}
std::string S9FrameNameSpriteSheetInsetsScaled::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered scaled 4.5 X width, 2.5 X height";
}
//// S9FrameNameSpriteSheetRotatedInsets
//
void S9FrameNameSpriteSheetRotatedInsets::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedInsets ...");
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedInsets done.");
}
std::string S9FrameNameSpriteSheetRotatedInsets::title()
{
return "Scale9Sprite scaled with insets sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotatedInsets::subtitle()
{
return "createWithSpriteFrameName(); cap insets=(32, 32, 32, 32)";
}
//
//// S9_TexturePacker
//
void S9_TexturePacker::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(s_s9s_ui_plist);
float x = winSize.width / 4;
float y = 0 + (winSize.height / 2);
CCLog("S9_TexturePacker ...");
auto s = Scale9Sprite::createWithSpriteFrameName("button_normal.png");
CCLog("... created");
s->setPosition(Point(x, y));
CCLog("... setPosition");
s->setContentSize(Size(21 * 16, 13 * 16));
CCLog("... setContentSize");
this->addChild(s);
CCLog("this->addChild");
x = winSize.width * 3/4;
auto s2 = Scale9Sprite::createWithSpriteFrameName("button_actived.png");
CCLog("... created");
s2->setPosition(Point(x, y));
CCLog("... setPosition");
s2->setContentSize(Size(21 * 16, 13 * 16));
CCLog("... setContentSize");
this->addChild(s2);
CCLog("this->addChild");
CCLog("... S9_TexturePacker done.");
}
std::string S9_TexturePacker::title()
{
return "Scale9Sprite from a spritesheet created with TexturePacker";
}
std::string S9_TexturePacker::subtitle()
{
return "createWithSpriteFrameName('button_normal.png');createWithSpriteFrameName('button_actived.png');";
}
//
//// S9FrameNameSpriteSheetRotatedInsetsScaled
//
void S9FrameNameSpriteSheetRotatedInsetsScaled::onEnter()
{
S9SpriteTestDemo::onEnter();
Size winSize = Director::sharedDirector()->getWinSize();
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedInsetsScaled ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedInsetsScaled done.");
}
std::string S9FrameNameSpriteSheetRotatedInsetsScaled::title()
{
return "Scale9Sprite scaled with insets sprite sheet (stored rotated)";
}
std::string S9FrameNameSpriteSheetRotatedInsetsScaled::subtitle()
{
return "createWithSpriteFrameName(); default cap insets; rendered scaled 4.5 X width, 2.5 X height";
}

View File

@ -0,0 +1,180 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013 Surith Thekkiam
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "testBasic.h"
#include "BaseTest.h"
class S9SpriteTestScene : public TestScene
{
public:
virtual void runThisTest();
};
class S9SpriteTestDemo : public BaseTest
{
public:
virtual void onEnter();
virtual void restartCallback(Object* sender);
virtual void nextCallback(Object* sender);
virtual void backCallback(Object* sender);
};
// S9BatchNodeBasic
class S9BatchNodeBasic : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheet
class S9FrameNameSpriteSheet : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotated
class S9FrameNameSpriteSheetRotated : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9BatchNodeScaledNoInsets
class S9BatchNodeScaledNoInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetScaledNoInsets
class S9FrameNameSpriteSheetScaledNoInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotatedScaledNoInsets
class S9FrameNameSpriteSheetRotatedScaledNoInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9BatchNodeScaleWithCapInsets
class S9BatchNodeScaleWithCapInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetInsets
class S9FrameNameSpriteSheetInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetInsetsScaled
class S9FrameNameSpriteSheetInsetsScaled : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotatedInsets
class S9FrameNameSpriteSheetRotatedInsets : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9_TexturePacker
class S9_TexturePacker : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};
// S9FrameNameSpriteSheetRotatedInsetsScaled
class S9FrameNameSpriteSheetRotatedInsetsScaled : public S9SpriteTestDemo
{
public:
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
};

View File

@ -39,5 +39,10 @@ static const char s_AtlasTest[] = "Images/atlastest.png";
static const char s_TilesPng[] = "TileMaps/tiles.png"; static const char s_TilesPng[] = "TileMaps/tiles.png";
static const char s_LevelMapTga[] = "TileMaps/levelmap.tga"; static const char s_LevelMapTga[] = "TileMaps/levelmap.tga";
// Scale9Sprite resource
static const char s_s9s_blocks9[] = "Images/blocks9ss.png";
static const char s_s9s_blocks9_plist[] = "Images/blocks9ss.plist";
static const char s_s9s_ui[] = "Images/ui.png";
static const char s_s9s_ui_plist[] = "Images/ui.plist";
#endif #endif

View File

@ -56,6 +56,7 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \ ../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \ ../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \ ../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
../Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
../Classes/FontTest/FontTest.cpp \ ../Classes/FontTest/FontTest.cpp \
../Classes/IntervalTest/IntervalTest.cpp \ ../Classes/IntervalTest/IntervalTest.cpp \
../Classes/KeypadTest/KeypadTest.cpp \ ../Classes/KeypadTest/KeypadTest.cpp \

View File

@ -59,6 +59,7 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \ ../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \ ../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \ ../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
../Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
../Classes/FontTest/FontTest.cpp \ ../Classes/FontTest/FontTest.cpp \
../Classes/IntervalTest/IntervalTest.cpp \ ../Classes/IntervalTest/IntervalTest.cpp \
../Classes/KeyboardTest/KeyboardTest.cpp \ ../Classes/KeyboardTest/KeyboardTest.cpp \

View File

@ -62,6 +62,7 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \ ../Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \ ../Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \ ../Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
../Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
../Classes/FileUtilsTest/FileUtilsTest.cpp \ ../Classes/FileUtilsTest/FileUtilsTest.cpp \
../Classes/FontTest/FontTest.cpp \ ../Classes/FontTest/FontTest.cpp \
../Classes/IntervalTest/IntervalTest.cpp \ ../Classes/IntervalTest/IntervalTest.cpp \

View File

@ -151,6 +151,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\libwebsockets\win32\lib\*.*" "$(O
<ClCompile Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.cpp" /> <ClCompile Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.cpp" /> <ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.cpp" /> <ClCompile Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.cpp" /> <ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.cpp" /> <ClCompile Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.cpp" />
<ClCompile Include="..\Classes\FileUtilsTest\FileUtilsTest.cpp" /> <ClCompile Include="..\Classes\FileUtilsTest\FileUtilsTest.cpp" />
@ -258,6 +259,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\libwebsockets\win32\lib\*.*" "$(O
<ClInclude Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.h" /> <ClInclude Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.h" /> <ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\HttpClientTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.h" /> <ClInclude Include="..\Classes\ExtensionsTest\NetworkTest\WebSocketTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.h" /> <ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\CustomTableViewCell.h" />
<ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.h" /> <ClInclude Include="..\Classes\ExtensionsTest\TableViewTest\TableViewTestScene.h" />
<ClInclude Include="..\Classes\FileUtilsTest\FileUtilsTest.h" /> <ClInclude Include="..\Classes\FileUtilsTest\FileUtilsTest.h" />

View File

@ -232,6 +232,9 @@
<Filter Include="Classes\ExtensionsTest\ComponentsTest"> <Filter Include="Classes\ExtensionsTest\ComponentsTest">
<UniqueIdentifier>{285cdfb8-5749-4969-ae31-99ec25f15e6e}</UniqueIdentifier> <UniqueIdentifier>{285cdfb8-5749-4969-ae31-99ec25f15e6e}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Classes\ExtensionsTest\Scale9SpriteTest">
<UniqueIdentifier>{3d73aa04-d66e-43d3-921f-b867a753c113}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
@ -543,6 +546,9 @@
<ClCompile Include="..\Classes\ExtensionsTest\ComponentsTest\SceneController.cpp"> <ClCompile Include="..\Classes\ExtensionsTest\ComponentsTest\SceneController.cpp">
<Filter>Classes\ExtensionsTest\ComponentsTest</Filter> <Filter>Classes\ExtensionsTest\ComponentsTest</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.cpp">
<Filter>Classes\ExtensionsTest\Scale9SpriteTest</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="main.h"> <ClInclude Include="main.h">
@ -1034,5 +1040,8 @@
<ClInclude Include="..\Classes\ExtensionsTest\ComponentsTest\SceneController.h"> <ClInclude Include="..\Classes\ExtensionsTest\ComponentsTest\SceneController.h">
<Filter>Classes\ExtensionsTest\ComponentsTest</Filter> <Filter>Classes\ExtensionsTest\ComponentsTest</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\Scale9SpriteTest\Scale9SpriteTest.h">
<Filter>Classes\ExtensionsTest\Scale9SpriteTest</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1 +1 @@
678e714c9c548501d076d34e2af0b13619e0a5aa 14e0d7211e9d0c638e41502416e3d944890dd856