More best practices fixes

- Removes Hungarian notation from the CPP test (there are still some Hungarian to remove)
- Label and MotionStreak: Uses the CL() entry for the tests (lambda functions)
This commit is contained in:
Ricardo Quesada 2013-07-22 17:25:44 -07:00
parent 4d3cb57718
commit c158cd5be6
84 changed files with 871 additions and 895 deletions

View File

@ -32,14 +32,14 @@ AppDelegate::~AppDelegate()
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
Director *pDirector = Director::getInstance();
pDirector->setOpenGLView(EGLView::getInstance());
Director *director = Director::getInstance();
director->setOpenGLView(EGLView::getInstance());
// turn on display FPS
//pDirector->setDisplayStats(true);
//director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
director->setAnimationInterval(1.0 / 60);
ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx);
@ -52,7 +52,7 @@ bool AppDelegate::applicationDidFinishLaunching()
scene->addChild(updateLayer);
updateLayer->release();
pDirector->runWithScene(scene);
director->runWithScene(scene);
return true;
}

View File

@ -19,12 +19,12 @@ AppDelegate::~AppDelegate()
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
Director* pDirector = Director::getInstance();
Director* director = Director::getInstance();
EGLView* pEGLView = EGLView::getInstance();
pDirector->setOpenGLView(pEGLView);
director->setOpenGLView(pEGLView);
Size size = pDirector->getWinSize();
Size size = director->getWinSize();
// Set the design resolution
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
@ -43,37 +43,37 @@ bool AppDelegate::applicationDidFinishLaunching() {
{
searchPath.push_back(largeResource.directory);
pDirector->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height, largeResource.size.width/designResolutionSize.width));
director->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height, largeResource.size.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small resource size, select medium resource.
else if (frameSize.height > smallResource.size.height)
{
searchPath.push_back(mediumResource.directory);
pDirector->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height, mediumResource.size.width/designResolutionSize.width));
director->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height, mediumResource.size.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium resource size, select small resource.
else
{
searchPath.push_back(smallResource.directory);
pDirector->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width));
director->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width));
}
// set searching path
FileUtils::getInstance()->setSearchPaths(searchPath);
// turn on display FPS
pDirector->setDisplayStats(true);
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
director->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
Scene *pScene = HelloWorld::scene();
Scene *scene = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
director->runWithScene(scene);
return true;
}

View File

@ -65,13 +65,13 @@ bool HelloWorld::init()
this->addChild(pLabel, 1);
// add "HelloWorld" splash screen"
Sprite* pSprite = Sprite::create("HelloWorld.png");
Sprite* scene = Sprite::create("HelloWorld.png");
// position the sprite on the center of the screen
pSprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
scene->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// add the sprite as a child to this layer
this->addChild(pSprite, 0);
this->addChild(scene, 0);
return true;
}

View File

@ -14,9 +14,9 @@ AppDelegate::~AppDelegate()
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
Director *pDirector = Director::getInstance();
Director *director = Director::getInstance();
pDirector->setOpenGLView(EGLView::getInstance());
director->setOpenGLView(EGLView::getInstance());
Size screenSize = EGLView::getInstance()->getFrameSize();
Size designSize = Size(480, 320);
@ -26,12 +26,12 @@ bool AppDelegate::applicationDidFinishLaunching() {
{
searchPaths.push_back("hd");
searchPaths.push_back("sd");
pDirector->setContentScaleFactor(640.0f/designSize.height);
director->setContentScaleFactor(640.0f/designSize.height);
}
else
{
searchPaths.push_back("sd");
pDirector->setContentScaleFactor(320.0f/designSize.height);
director->setContentScaleFactor(320.0f/designSize.height);
}
FileUtils::getInstance()->setSearchPaths(searchPaths);
@ -39,16 +39,16 @@ bool AppDelegate::applicationDidFinishLaunching() {
EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
// turn on display FPS
pDirector->setDisplayStats(true);
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
director->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
Scene *pScene = HelloWorld::scene();
Scene *scene = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
director->runWithScene(scene);
return true;
}

View File

@ -85,9 +85,9 @@ void AccelerometerTest::didAccelerate(Acceleration* pAccelerationValue)
//------------------------------------------------------------------
void AccelerometerTestScene::runThisTest()
{
Layer* pLayer = new AccelerometerTest();
addChild(pLayer);
pLayer->release();
Layer* layer = new AccelerometerTest();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -36,10 +36,10 @@ Layer* nextActionManagerAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createActionManagerLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createActionManagerLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backActionManagerAction()
@ -49,18 +49,18 @@ Layer* backActionManagerAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createActionManagerLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createActionManagerLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartActionManagerAction()
{
Layer* pLayer = createActionManagerLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createActionManagerLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
//------------------------------------------------------------------
@ -209,8 +209,8 @@ void PauseTest::onEnter()
Action* action = MoveBy::create(1, Point(150,0));
Director* pDirector = Director::getInstance();
pDirector->getActionManager()->addAction(action, grossini, true);
Director* director = Director::getInstance();
director->getActionManager()->addAction(action, grossini, true);
schedule( schedule_selector(PauseTest::unpause), 3);
}
@ -219,8 +219,8 @@ void PauseTest::unpause(float dt)
{
unschedule( schedule_selector(PauseTest::unpause) );
Node* node = getChildByTag( kTagGrossini );
Director* pDirector = Director::getInstance();
pDirector->getActionManager()->resumeTarget(node);
Director* director = Director::getInstance();
director->getActionManager()->resumeTarget(node);
}
std::string PauseTest::title()
@ -255,8 +255,8 @@ void RemoveTest::onEnter()
void RemoveTest::stopAction()
{
Node* pSprite = getChildByTag(kTagGrossini);
pSprite->stopActionByTag(kTagSequence);
Node* scene = getChildByTag(kTagGrossini);
scene->stopActionByTag(kTagSequence);
}
std::string RemoveTest::title()
@ -288,8 +288,8 @@ void ResumeTest::onEnter()
pGrossini->runAction(ScaleBy::create(2, 2));
Director* pDirector = Director::getInstance();
pDirector->getActionManager()->pauseTarget(pGrossini);
Director* director = Director::getInstance();
director->getActionManager()->pauseTarget(pGrossini);
pGrossini->runAction(RotateBy::create(2, 360));
this->schedule(schedule_selector(ResumeTest::resumeGrossini), 3.0f);
@ -300,8 +300,8 @@ void ResumeTest::resumeGrossini(float time)
this->unschedule(schedule_selector(ResumeTest::resumeGrossini));
Node* pGrossini = getChildByTag(kTagGrossini);
Director* pDirector = Director::getInstance();
pDirector->getActionManager()->resumeTarget(pGrossini);
Director* director = Director::getInstance();
director->getActionManager()->resumeTarget(pGrossini);
}
//------------------------------------------------------------------
@ -311,8 +311,8 @@ void ResumeTest::resumeGrossini(float time)
//------------------------------------------------------------------
void ActionManagerTestScene::runThisTest()
{
Layer* pLayer = nextActionManagerAction();
addChild(pLayer);
Layer* layer = nextActionManagerAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -552,10 +552,10 @@ Layer* nextEaseAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createEaseLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createEaseLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backEaseAction()
@ -565,18 +565,18 @@ Layer* backEaseAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createEaseLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createEaseLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartEaseAction()
{
Layer* pLayer = createEaseLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createEaseLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
@ -649,8 +649,8 @@ void EaseSpriteDemo::backCallback(Object* pSender)
void ActionsEaseTestScene::runThisTest()
{
Layer* pLayer = nextEaseAction();
addChild(pLayer);
Layer* layer = nextEaseAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -30,10 +30,10 @@ Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backAction()
@ -43,18 +43,18 @@ Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartAction()
{
Layer* pLayer = createLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}

View File

@ -61,11 +61,11 @@ static Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction()
@ -75,20 +75,20 @@ static Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
void ActionsTestScene::runThisTest()

View File

@ -27,8 +27,11 @@ bool AppDelegate::applicationDidFinishLaunching()
Configuration::getInstance()->loadConfigFile("configs/config-example.plist");
// initialize director
Director *pDirector = Director::getInstance();
pDirector->setOpenGLView(EGLView::getInstance());
Director *director = Director::getInstance();
director->setOpenGLView(EGLView::getInstance());
director->setDisplayStats(true);
director->setAnimationInterval(1.0 / 60);
Size screenSize = EGLView::getInstance()->getFrameSize();
@ -42,17 +45,17 @@ bool AppDelegate::applicationDidFinishLaunching()
std::vector<std::string> searchPaths;
searchPaths.push_back("hd");
pFileUtils->setSearchPaths(searchPaths);
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
director->setContentScaleFactor(resourceSize.height/designSize.height);
}
EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
Scene * pScene = Scene::create();
Layer * pLayer = new TestController();
pLayer->autorelease();
auto scene = Scene::create();
auto layer = new TestController();
layer->autorelease();
pScene->addChild(pLayer);
pDirector->runWithScene(pScene);
scene->addChild(layer);
director->runWithScene(scene);
return true;
}

View File

@ -248,9 +248,9 @@ void Box2DTestLayer::accelerometer(UIAccelerometer* accelerometer, Acceleration*
void Box2DTestScene::runThisTest()
{
Layer* pLayer = new Box2DTestLayer();
addChild(pLayer);
pLayer->release();
Layer* layer = new Box2DTestLayer();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -37,18 +37,18 @@ MenuLayer::~MenuLayer(void)
MenuLayer* MenuLayer::menuWithEntryID(int entryId)
{
MenuLayer* pLayer = new MenuLayer();
pLayer->initWithEntryID(entryId);
pLayer->autorelease();
MenuLayer* layer = new MenuLayer();
layer->initWithEntryID(entryId);
layer->autorelease();
return pLayer;
return layer;
}
bool MenuLayer::initWithEntryID(int entryId)
{
Director* pDirector = Director::getInstance();
Point visibleOrigin = pDirector->getVisibleOrigin();
Size visibleSize = pDirector->getVisibleSize();
Director* director = Director::getInstance();
Point visibleOrigin = director->getVisibleOrigin();
Size visibleSize = director->getVisibleSize();
m_entryID = entryId;
@ -121,8 +121,8 @@ void MenuLayer::backCallback(Object* sender)
void MenuLayer::registerWithTouchDispatcher()
{
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
Director* director = Director::getInstance();
director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
}
bool MenuLayer::ccTouchBegan(Touch* touch, Event* event)
@ -210,8 +210,8 @@ Box2DView::~Box2DView()
void Box2DView::registerWithTouchDispatcher()
{
// higher priority than dragging
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->addTargetedDelegate(this, -10, true);
Director* director = Director::getInstance();
director->getTouchDispatcher()->addTargetedDelegate(this, -10, true);
}
bool Box2DView::ccTouchBegan(Touch* touch, Event* event)

View File

@ -11,11 +11,11 @@
Scene* Bug1159Layer::scene()
{
Scene *pScene = Scene::create();
Scene *scene = Scene::create();
Bug1159Layer* layer = Bug1159Layer::create();
pScene->addChild(layer);
scene->addChild(layer);
return pScene;
return scene;
}
bool Bug1159Layer::init()

View File

@ -52,9 +52,9 @@ void Bug422Layer::check(Node* t)
CCARRAY_FOREACH(array, pChild)
{
CC_BREAK_IF(! pChild);
Node* pNode = static_cast<Node*>(pChild);
CCLog("%p, rc: %d", pNode, pNode->retainCount());
check(pNode);
Node* node = static_cast<Node*>(pChild);
CCLog("%p, rc: %d", node, node->retainCount());
check(node);
}
}

View File

@ -12,15 +12,15 @@
Scene* Bug914Layer::scene()
{
// 'scene' is an autorelease object.
Scene *pScene = Scene::create();
Scene *scene = Scene::create();
// 'layer' is an autorelease object.
Bug914Layer* layer = Bug914Layer::create();
// add layer as a child to scene
pScene->addChild(layer);
scene->addChild(layer);
// return the scene
return pScene;
return scene;
}
// on "init" you need to initialize your instance

View File

@ -11,12 +11,12 @@
#define TEST_BUG(__bug__) \
{ \
Scene* pScene = Scene::create(); \
Bug##__bug__##Layer* pLayer = new Bug##__bug__##Layer(); \
pLayer->init(); \
pScene->addChild(pLayer); \
Director::getInstance()->replaceScene(pScene); \
pLayer->autorelease(); \
Scene* scene = Scene::create(); \
Bug##__bug__##Layer* layer = new Bug##__bug__##Layer(); \
layer->init(); \
scene->addChild(layer); \
Director::getInstance()->replaceScene(scene); \
layer->autorelease(); \
}
enum
@ -125,9 +125,9 @@ void BugsTestBaseLayer::onEnter()
void BugsTestBaseLayer::backCallback(Object* pSender)
{
// Director::getInstance()->enableRetinaDisplay(false);
BugsTestScene* pScene = new BugsTestScene();
pScene->runThisTest();
pScene->autorelease();
BugsTestScene* scene = new BugsTestScene();
scene->runThisTest();
scene->autorelease();
}
////////////////////////////////////////////////////////
@ -137,9 +137,9 @@ void BugsTestBaseLayer::backCallback(Object* pSender)
////////////////////////////////////////////////////////
void BugsTestScene::runThisTest()
{
Layer* pLayer = new BugsTestMainLayer();
addChild(pLayer);
pLayer->release();
Layer* layer = new BugsTestMainLayer();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -242,9 +242,9 @@ void ChipmunkTestLayer::didAccelerate(Acceleration* pAccelerationValue)
void ChipmunkAccelTouchTestScene::runThisTest()
{
Layer* pLayer = new ChipmunkTestLayer();
addChild(pLayer);
pLayer->release();
Layer* layer = new ChipmunkTestLayer();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -8,10 +8,10 @@ enum
void ClickAndMoveTestScene::runThisTest()
{
Layer* pLayer = new MainLayer();
pLayer->autorelease();
Layer* layer = new MainLayer();
layer->autorelease();
addChild(pLayer);
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -56,11 +56,11 @@ static Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction()
@ -70,20 +70,20 @@ static Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
//#pragma mark Demo examples start here
@ -844,7 +844,7 @@ void RawStencilBufferTest6::setupStencilForDrawingOnPlane(GLint plane)
void ClippingNodeTestScene::runThisTest()
{
Layer* pLayer = nextAction();
addChild(pLayer);
Layer* layer = nextAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -414,9 +414,9 @@ void CocosDenshionTest::updateVolumes(float)
void CocosDenshionTestScene::runThisTest()
{
Layer* pLayer = new CocosDenshionTest();
addChild(pLayer);
pLayer->autorelease();
Layer* layer = new CocosDenshionTest();
addChild(layer);
layer->autorelease();
Director::getInstance()->replaceScene(this);
}

View File

@ -25,11 +25,11 @@ static Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction()
@ -39,20 +39,20 @@ static Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
void ConfigurationTestScene::runThisTest()

View File

@ -58,9 +58,9 @@ CurlTest::~CurlTest()
void CurlTestScene::runThisTest()
{
Layer* pLayer = new CurlTest();
addChild(pLayer);
Layer* layer = new CurlTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
pLayer->release();
layer->release();
}

View File

@ -61,9 +61,9 @@ CurrentLanguageTest::CurrentLanguageTest()
void CurrentLanguageTestScene::runThisTest()
{
Layer* pLayer = new CurrentLanguageTest();
addChild(pLayer);
Layer* layer = new CurrentLanguageTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
pLayer->release();
layer->release();
}

View File

@ -30,10 +30,10 @@ static Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction()
@ -43,18 +43,18 @@ static Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
// BaseLayer
@ -300,8 +300,8 @@ string DrawNodeTest::subtitle()
void DrawPrimitivesTestScene::runThisTest()
{
Layer* pLayer = nextAction();
addChild(pLayer);
Layer* layer = nextAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -303,10 +303,10 @@ Layer* nextEffectAdvanceAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createEffectAdvanceLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createEffectAdvanceLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backEffectAdvanceAction()
@ -316,18 +316,18 @@ Layer* backEffectAdvanceAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createEffectAdvanceLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createEffectAdvanceLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartEffectAdvanceAction()
{
Layer* pLayer = createEffectAdvanceLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createEffectAdvanceLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
@ -396,8 +396,8 @@ void EffectAdvanceTextLayer::backCallback(Object* pSender)
void EffectAdvanceScene::runThisTest()
{
Layer* pLayer = nextEffectAdvanceAction();
Layer* layer = nextEffectAdvanceAction();
addChild(pLayer);
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -388,10 +388,10 @@ TextLayer::~TextLayer(void)
TextLayer* TextLayer::create()
{
TextLayer* pLayer = new TextLayer();
pLayer->autorelease();
TextLayer* layer = new TextLayer();
layer->autorelease();
return pLayer;
return layer;
}
void TextLayer::onEnter()

View File

@ -13,38 +13,38 @@ static int s_nActionIdx = -1;
Layer *CreateLayer(int index)
{
Layer *pLayer = NULL;
Layer *layer = NULL;
switch(index)
{
case TEST_DRAGON_BONES_2_0:
pLayer = new TestDragonBones20(); break;
layer = new TestDragonBones20(); break;
case TEST_COCOSTUDIO_WITH_SKELETON:
pLayer = new TestCSWithSkeleton(); break;
layer = new TestCSWithSkeleton(); break;
case TEST_COCOSTUDIO_WITHOUT_SKELETON:
pLayer = new TestCSWithoutSkeleton(); break;
layer = new TestCSWithoutSkeleton(); break;
case TEST_PERFORMANCE:
pLayer = new TestPerformance(); break;
layer = new TestPerformance(); break;
case TEST_CHANGE_ZORDER:
pLayer = new TestChangeZorder(); break;
layer = new TestChangeZorder(); break;
case TEST_ANIMATION_EVENT:
pLayer = new TestAnimationEvent(); break;
layer = new TestAnimationEvent(); break;
case TEST_PARTICLE_DISPLAY:
pLayer = new TestParticleDisplay(); break;
layer = new TestParticleDisplay(); break;
case TEST_USE_DIFFERENT_PICTURE:
pLayer = new TestUseMutiplePicture(); break;
layer = new TestUseMutiplePicture(); break;
case TEST_BOX2D_DETECTOR:
pLayer = new TestBox2DDetector(); break;
layer = new TestBox2DDetector(); break;
case TEST_BOUDINGBOX:
pLayer = new TestBoundingBox(); break;
layer = new TestBoundingBox(); break;
case TEST_ANCHORPOINT:
pLayer = new TestAnchorPoint(); break;
layer = new TestAnchorPoint(); break;
case TEST_ARMATURE_NESTING:
pLayer = new TestArmatureNesting(); break;
layer = new TestArmatureNesting(); break;
default:
break;
}
return pLayer;
return layer;
}
@ -53,10 +53,10 @@ Layer* NextTest()
++s_nActionIdx;
s_nActionIdx = s_nActionIdx % TEST_LAYER_COUNT;
Layer* pLayer = CreateLayer(s_nActionIdx);
pLayer->autorelease();
Layer* layer = CreateLayer(s_nActionIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* BackTest()
@ -65,18 +65,18 @@ Layer* BackTest()
if( s_nActionIdx < 0 )
s_nActionIdx += TEST_LAYER_COUNT;
Layer* pLayer = CreateLayer(s_nActionIdx);
pLayer->autorelease();
Layer* layer = CreateLayer(s_nActionIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* RestartTest()
{
Layer* pLayer = CreateLayer(s_nActionIdx);
pLayer->autorelease();
Layer* layer = CreateLayer(s_nActionIdx);
layer->autorelease();
return pLayer;
return layer;
}

View File

@ -17,7 +17,7 @@ public:
virtual cocos2d::SEL_MenuHandler onResolveCCBMenuItemSelector(Object * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBControlSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * pNode);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * node);
void onControlButtonIdleClicked(cocos2d::Object * pSender, cocos2d::extension::ControlEvent pControlEvent);
void onControlButtonWaveClicked(cocos2d::Object * pSender, cocos2d::extension::ControlEvent pControlEvent);

View File

@ -17,7 +17,7 @@ public:
virtual cocos2d::SEL_MenuHandler onResolveCCBMenuItemSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBControlSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * pNode);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * node);
void onControlButtonClicked(cocos2d::Object * pSender, cocos2d::extension::ControlEvent pControlEvent);

View File

@ -24,13 +24,13 @@ HelloCocosBuilderLayer::~HelloCocosBuilderLayer()
CC_SAFE_RELEASE(mTestTitleLabelTTF);
}
void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * pNodeName, NodeLoader * pNodeLoader) {
void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * nodeName, NodeLoader * nodeLoader) {
/* Create an autorelease NodeLoaderLibrary. */
NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
ccNodeLoaderLibrary->registerNodeLoader("TestHeaderLayer", TestHeaderLayerLoader::loader());
if(pNodeName != NULL && pNodeLoader != NULL) {
ccNodeLoaderLibrary->registerNodeLoader(pNodeName, pNodeLoader);
if(nodeName != NULL && nodeLoader != NULL) {
ccNodeLoaderLibrary->registerNodeLoader(nodeName, nodeLoader);
}
/* Create an autorelease CCBReader. */
@ -61,7 +61,7 @@ void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * pN
}
void HelloCocosBuilderLayer::onNodeLoaded(cocos2d::Node * pNode, cocos2d::extension::NodeLoader * pNodeLoader) {
void HelloCocosBuilderLayer::onNodeLoaded(cocos2d::Node * node, cocos2d::extension::NodeLoader * nodeLoader) {
RotateBy * ccRotateBy = RotateBy::create(20.0f, 360);
RepeatForever * ccRepeatForever = RepeatForever::create(ccRotateBy);
this->mBurstSprite->runAction(ccRepeatForever);

View File

@ -26,13 +26,13 @@ class HelloCocosBuilderLayer
HelloCocosBuilderLayer();
virtual ~HelloCocosBuilderLayer();
void openTest(const char * pCCBFileName, const char * pNodeName = NULL, cocos2d::extension::NodeLoader * pNodeLoader = NULL);
void openTest(const char * pCCBFileName, const char * nodeName = NULL, cocos2d::extension::NodeLoader * nodeLoader = NULL);
virtual cocos2d::SEL_MenuHandler onResolveCCBMenuItemSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBControlSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * pNode);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * node);
virtual bool onAssignCCBCustomProperty(Object* pTarget, const char* pMemberVariableName, cocos2d::extension::CCBValue* pCCBValue);
virtual void onNodeLoaded(cocos2d::Node * pNode, cocos2d::extension::NodeLoader * pNodeLoader);
virtual void onNodeLoaded(cocos2d::Node * node, cocos2d::extension::NodeLoader * nodeLoader);
void onMenuTestClicked(cocos2d::Object * pSender, cocos2d::extension::ControlEvent pControlEvent);
void onSpriteTestClicked(cocos2d::Object * pSender, cocos2d::extension::ControlEvent pControlEvent);

View File

@ -17,7 +17,7 @@ class MenuTestLayer
virtual cocos2d::SEL_MenuHandler onResolveCCBMenuItemSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBControlSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * pNode);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * node);
void onMenuItemAClicked(cocos2d::Object * pSender);
void onMenuItemBClicked(cocos2d::Object * pSender);

View File

@ -14,7 +14,7 @@ SEL_CCControlHandler TestHeaderLayer::onResolveCCBControlSelector(Object * pTarg
return NULL;
}
void TestHeaderLayer::onNodeLoaded(cocos2d::Node * pNode, cocos2d::extension::NodeLoader * pNodeLoader)
void TestHeaderLayer::onNodeLoaded(cocos2d::Node * node, cocos2d::extension::NodeLoader * nodeLoader)
{
CCLOG("TestHeaderLayer::onNodeLoaded");
}

View File

@ -14,7 +14,7 @@ class TestHeaderLayer
virtual cocos2d::SEL_MenuHandler onResolveCCBMenuItemSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBControlSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual void onNodeLoaded(cocos2d::Node * pNode, cocos2d::extension::NodeLoader * pNodeLoader);
virtual void onNodeLoaded(cocos2d::Node * node, cocos2d::extension::NodeLoader * nodeLoader);
void onBackClicked(cocos2d::Object * pSender);
};

View File

@ -18,7 +18,7 @@ class TimelineCallbackTestLayer
virtual cocos2d::SEL_MenuHandler onResolveCCBMenuItemSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBControlSelector(cocos2d::Object * pTarget, const char * pSelectorName);
virtual cocos2d::SEL_CallFuncN onResolveCCBCallFuncSelector(Object * pTarget, const char* pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * pNode);
virtual bool onAssignCCBMemberVariable(cocos2d::Object * pTarget, const char * pMemberVariableName, cocos2d::Node * node);
void onCallback1(Node* sender);
void onCallback2(Node* sender);

View File

@ -81,9 +81,9 @@ cocos2d::Node* ComponentsTestLayer::createGameScene()
MenuItemFont *itemBack = MenuItemFont::create("Back", [](Object* sender){
ExtensionsTestScene *pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
});
itemBack->setColor(Color3B(0, 0, 0));
@ -99,6 +99,6 @@ cocos2d::Node* ComponentsTestLayer::createGameScene()
void runComponentsTestLayerTest()
{
Scene *pScene = ComponentsTestLayer::scene();
Director::getInstance()->replaceScene(pScene);
Scene *scene = ComponentsTestLayer::scene();
Director::getInstance()->replaceScene(scene);
}

View File

@ -73,9 +73,9 @@ bool GameOverLayer::init()
MenuItemFont *itemBack = MenuItemFont::create("Back", [](Object* sender){
ExtensionsTestScene *pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
});
itemBack->setColor(Color3B(0, 0, 0));

View File

@ -84,9 +84,9 @@ bool ControlScene::init()
void ControlScene::toExtensionsMainLayer(Object* sender)
{
ExtensionsTestScene* pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene* scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
}
void ControlScene::previousCallback(Object* sender)

View File

@ -37,19 +37,19 @@ USING_NS_CC_EXT;
public: \
static Scene* sceneWithTitle(const char * title) \
{ \
Scene* pScene = Scene::create(); \
Scene* scene = Scene::create(); \
controlScene* controlLayer = new controlScene(); \
if (controlLayer && controlLayer->init()) \
{ \
controlLayer->autorelease(); \
controlLayer->getSceneTitleLabel()->setString(title); \
pScene->addChild(controlLayer); \
scene->addChild(controlLayer); \
} \
else \
{ \
CC_SAFE_DELETE(controlLayer); \
} \
return pScene; \
return scene; \
}

View File

@ -87,9 +87,9 @@ EditBoxTest::~EditBoxTest()
void EditBoxTest::toExtensionsMainLayer(cocos2d::Object *sender)
{
ExtensionsTestScene *pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
}
void EditBoxTest::editBoxEditingDidBegin(cocos2d::extension::EditBox* editBox)
@ -127,10 +127,10 @@ void EditBoxTest::editBoxReturn(EditBox* editBox)
void runEditBoxTest()
{
Scene *pScene = Scene::create();
EditBoxTest *pLayer = new EditBoxTest();
pScene->addChild(pLayer);
Scene *scene = Scene::create();
EditBoxTest *layer = new EditBoxTest();
scene->addChild(layer);
Director::getInstance()->replaceScene(pScene);
pLayer->release();
Director::getInstance()->replaceScene(scene);
layer->release();
}

View File

@ -34,25 +34,25 @@ static struct {
{ "NotificationCenterTest", [](Object* sender) { runNotificationCenterTest(); }
},
{ "Scale9SpriteTest", [](Object* sender) {
S9SpriteTestScene* pScene = new S9SpriteTestScene();
if (pScene)
S9SpriteTestScene* scene = new S9SpriteTestScene();
if (scene)
{
pScene->runThisTest();
pScene->release();
scene->runThisTest();
scene->release();
}
}
},
{ "CCControlButtonTest", [](Object *sender){
ControlSceneManager* pManager = ControlSceneManager::sharedControlSceneManager();
Scene* pScene = pManager->currentControlScene();
Director::getInstance()->replaceScene(pScene);
Scene* scene = pManager->currentControlScene();
Director::getInstance()->replaceScene(scene);
}},
{ "CocosBuilderTest", [](Object *sender) {
TestScene* pScene = new CocosBuilderTestScene();
if (pScene)
TestScene* scene = new CocosBuilderTestScene();
if (scene)
{
pScene->runThisTest();
pScene->release();
scene->runThisTest();
scene->release();
}
}},
#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN) && (CC_TARGET_PLATFORM != CC_PLATFORM_NACL)
@ -73,9 +73,9 @@ static struct {
},
{ "CommponentTest", [](Object *sender) { runComponentsTestLayerTest(); }
},
{ "ArmatureTest", [](Object *sender) { ArmatureTestScene *pScene = new ArmatureTestScene();
pScene->runThisTest();
pScene->release();
{ "ArmatureTest", [](Object *sender) { ArmatureTestScene *scene = new ArmatureTestScene();
scene->runThisTest();
scene->release();
}
},
};
@ -153,9 +153,9 @@ void ExtensionsMainLayer::ccTouchesMoved(Set *pTouches, Event *pEvent)
void ExtensionsTestScene::runThisTest()
{
Layer* pLayer = new ExtensionsMainLayer();
addChild(pLayer);
pLayer->release();
Layer* layer = new ExtensionsMainLayer();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -283,17 +283,17 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re
void HttpClientTest::toExtensionsMainLayer(cocos2d::Object *sender)
{
ExtensionsTestScene *pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
}
void runHttpClientTest()
{
Scene *pScene = Scene::create();
HttpClientTest *pLayer = new HttpClientTest();
pScene->addChild(pLayer);
Scene *scene = Scene::create();
HttpClientTest *layer = new HttpClientTest();
scene->addChild(layer);
Director::getInstance()->replaceScene(pScene);
pLayer->release();
Director::getInstance()->replaceScene(scene);
layer->release();
}

View File

@ -125,9 +125,9 @@ void SocketIOTestLayer::echotest(SIOClient *client, const std::string& data) {
void SocketIOTestLayer::toExtensionsMainLayer(cocos2d::Object *sender)
{
ExtensionsTestScene *pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
if(_sioEndpoint) _sioEndpoint->disconnect();
if(_sioClient) _sioClient->disconnect();
@ -259,10 +259,10 @@ void SocketIOTestLayer::onError(cocos2d::extension::SIOClient* client, const std
void runSocketIOTest()
{
Scene *pScene = Scene::create();
SocketIOTestLayer *pLayer = new SocketIOTestLayer();
pScene->addChild(pLayer);
Scene *scene = Scene::create();
SocketIOTestLayer *layer = new SocketIOTestLayer();
scene->addChild(layer);
Director::getInstance()->replaceScene(pScene);
pLayer->release();
Director::getInstance()->replaceScene(scene);
layer->release();
}

View File

@ -193,9 +193,9 @@ void WebSocketTestLayer::onError(cocos2d::extension::WebSocket* ws, const cocos2
void WebSocketTestLayer::toExtensionsMainLayer(cocos2d::Object *sender)
{
ExtensionsTestScene *pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
}
// Menu Callbacks
@ -232,10 +232,10 @@ void WebSocketTestLayer::onMenuSendBinaryClicked(cocos2d::Object *sender)
void runWebSocketTest()
{
Scene *pScene = Scene::create();
WebSocketTestLayer *pLayer = new WebSocketTestLayer();
pScene->addChild(pLayer);
Scene *scene = Scene::create();
WebSocketTestLayer *layer = new WebSocketTestLayer();
scene->addChild(layer);
Director::getInstance()->replaceScene(pScene);
pLayer->release();
Director::getInstance()->replaceScene(scene);
layer->release();
}

View File

@ -140,9 +140,9 @@ void NotificationCenterTest::toExtensionsMainLayer(cocos2d::Object* sender)
int CC_UNUSED numObserversRemoved = NotificationCenter::getInstance()->removeAllObservers(this);
CCASSERT(numObserversRemoved >= 3, "All observers were not removed!");
ExtensionsTestScene* pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene* scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
}
void NotificationCenterTest::toggleSwitch(Object *sender)
@ -167,9 +167,9 @@ void NotificationCenterTest::doNothing(cocos2d::Object *sender)
void runNotificationCenterTest()
{
Scene* pScene = Scene::create();
NotificationCenterTest* pLayer = new NotificationCenterTest();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
pLayer->release();
Scene* scene = Scene::create();
NotificationCenterTest* layer = new NotificationCenterTest();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
layer->release();
}

View File

@ -57,11 +57,11 @@ static Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction()
@ -71,20 +71,20 @@ static Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
void S9SpriteTestScene::runThisTest()

View File

@ -7,10 +7,10 @@ USING_NS_CC_EXT;
void runTableViewTest()
{
Scene *pScene = Scene::create();
TableViewTestLayer *pLayer = TableViewTestLayer::create();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
Scene *scene = Scene::create();
TableViewTestLayer *layer = TableViewTestLayer::create();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
}
// on "init" you need to initialize your instance
@ -50,9 +50,9 @@ bool TableViewTestLayer::init()
void TableViewTestLayer::toExtensionsMainLayer(cocos2d::Object *sender)
{
ExtensionsTestScene *pScene = new ExtensionsTestScene();
pScene->runThisTest();
pScene->release();
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
}
void TableViewTestLayer::tableCellTouched(TableView* table, TableViewCell* cell)

View File

@ -23,11 +23,11 @@ static Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction()
@ -37,26 +37,26 @@ static Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
void FileUtilsTestScene::runThisTest()
{
Layer* pLayer = nextAction();
addChild(pLayer);
Layer* layer = nextAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}
@ -70,32 +70,32 @@ void FileUtilsDemo::onEnter()
void FileUtilsDemo::backCallback(Object* pSender)
{
Scene* pScene = new FileUtilsTestScene();
Layer* pLayer = backAction();
Scene* scene = new FileUtilsTestScene();
Layer* layer = backAction();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
pScene->release();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
scene->release();
}
void FileUtilsDemo::nextCallback(Object* pSender)
{
Scene* pScene = new FileUtilsTestScene();
Layer* pLayer = nextAction();
Scene* scene = new FileUtilsTestScene();
Layer* layer = nextAction();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
pScene->release();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
scene->release();
}
void FileUtilsDemo::restartCallback(Object* pSender)
{
Scene* pScene = new FileUtilsTestScene();
Layer* pLayer = restartAction();
Scene* scene = new FileUtilsTestScene();
Layer* layer = restartAction();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
pScene->release();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
scene->release();
}
string FileUtilsDemo::title()

View File

@ -166,8 +166,8 @@ void FontTest::restartCallback(Object* pSender)
///---------------------------------------
void FontTestScene::runThisTest()
{
Layer* pLayer = FontTest::create();
addChild(pLayer);
Layer* layer = FontTest::create();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -123,9 +123,9 @@ void IntervalLayer::step4(float dt)
void IntervalTestScene::runThisTest()
{
Layer* pLayer = new IntervalLayer();
addChild(pLayer);
pLayer->release();
Layer* layer = new IntervalLayer();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -36,11 +36,11 @@ void KeyboardTest::keyReleased(int keyCode)
void KeyboardTestScene::runThisTest()
{
Layer* pLayer = new KeyboardTest();
addChild(pLayer);
Layer* layer = new KeyboardTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
pLayer->release();
layer->release();
}
#endif

View File

@ -34,9 +34,9 @@ void KeypadTest::keyMenuClicked()
void KeypadTestScene::runThisTest()
{
Layer* pLayer = new KeypadTest();
addChild(pLayer);
Layer* layer = new KeypadTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
pLayer->release();
layer->release();
}

View File

@ -40,56 +40,51 @@ Layer* restartAtlasAction();
static int sceneIdx = -1;
#define MAX_LAYER 28
Layer* createAtlasLayer(int nIndex)
static std::function<Layer*()> createFunctions[] =
{
switch(nIndex)
{
case 0: return new LabelAtlasTest();
case 1: return new LabelAtlasColorTest();
case 2: return new Atlas3();
case 3: return new Atlas4();
case 4: return new Atlas5();
case 5: return new Atlas6();
case 6: return new AtlasBitmapColor();
case 7: return new AtlasFastBitmap();
case 8: return new BitmapFontMultiLine();
case 9: return new LabelsEmpty();
case 10: return new LabelBMFontHD();
case 11: return new LabelAtlasHD();
case 12: return new LabelGlyphDesigner();
CL(LabelAtlasTest),
CL(LabelAtlasColorTest),
CL(Atlas3),
CL(Atlas4),
CL(Atlas5),
CL(Atlas6),
CL(AtlasBitmapColor),
CL(AtlasFastBitmap),
CL(BitmapFontMultiLine),
CL(LabelsEmpty),
CL(LabelBMFontHD),
CL(LabelAtlasHD),
CL(LabelGlyphDesigner),
CL(LabelTTFTest),
CL(LabelTTFMultiline),
CL(LabelTTFChinese),
CL(LabelBMFontChinese),
CL(BitmapFontMultiLineAlignment),
CL(LabelTTFA8Test),
CL(BMFontOneAtlas),
CL(BMFontUnicode),
CL(BMFontInit),
CL(TTFFontInit),
CL(Issue1343),
CL(LabelTTFAlignment),
CL(LabelBMFontBounds),
CL(TTFFontShadowAndStroke),
// Not a label test. Should be moved to Atlas test
case 13: return new Atlas1();
case 14: return new LabelTTFTest();
case 15: return new LabelTTFMultiline();
case 16: return new LabelTTFChinese();
case 17: return new LabelBMFontChinese();
case 18: return new BitmapFontMultiLineAlignment();
case 19: return new LabelTTFA8Test();
case 20: return new BMFontOneAtlas();
case 21: return new BMFontUnicode();
case 22: return new BMFontInit();
case 23: return new TTFFontInit();
case 24: return new Issue1343();
case 25: return new LabelTTFAlignment();
case 26: return new LabelBMFontBounds();
case 27: return new TTFFontShadowAndStroke();
}
// should be moved to another test
CL(Atlas1),
};
return NULL;
}
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
Layer* nextAtlasAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createAtlasLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
Layer* backAtlasAction()
@ -99,18 +94,18 @@ Layer* backAtlasAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createAtlasLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartAtlasAction()
{
Layer* pLayer = createAtlasLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
@ -801,9 +796,9 @@ LabelsEmpty::LabelsEmpty()
void LabelsEmpty::updateStrings(float dt)
{
LabelBMFont* label1 = (LabelBMFont*) getChildByTag(kTagBitmapAtlas1);
LabelTTF* label2 = (LabelTTF*) getChildByTag(kTagBitmapAtlas2);
LabelAtlas* label3 = (LabelAtlas*) getChildByTag(kTagBitmapAtlas3);
auto label1 = static_cast<LabelBMFont*>( getChildByTag(kTagBitmapAtlas1) );
auto label2 = static_cast<LabelTTF*>( getChildByTag(kTagBitmapAtlas2) );
auto label3 = static_cast<LabelAtlas*>( getChildByTag(kTagBitmapAtlas3) );
if( ! setEmpty )
{
@ -843,7 +838,7 @@ LabelBMFontHD::LabelBMFontHD()
Size s = Director::getInstance()->getWinSize();
// LabelBMFont
LabelBMFont *label1 = LabelBMFont::create("TESTING RETINA DISPLAY", "fonts/konqa32.fnt");
auto label1 = LabelBMFont::create("TESTING RETINA DISPLAY", "fonts/konqa32.fnt");
addChild(label1);
label1->setPosition(Point(s.width/2, s.height/2));
}
@ -868,7 +863,7 @@ LabelAtlasHD::LabelAtlasHD()
Size s = Director::getInstance()->getWinSize();
// LabelBMFont
LabelAtlas *label1 = LabelAtlas::create("TESTING RETINA DISPLAY", "fonts/larabie-16.plist");
auto label1 = LabelAtlas::create("TESTING RETINA DISPLAY", "fonts/larabie-16.plist");
label1->setAnchorPoint(Point(0.5f, 0.5f));
addChild(label1);
@ -894,11 +889,11 @@ LabelGlyphDesigner::LabelGlyphDesigner()
{
Size s = Director::getInstance()->getWinSize();
LayerColor *layer = LayerColor::create(Color4B(128,128,128,255));
auto layer = LayerColor::create(Color4B(128,128,128,255));
addChild(layer, -10);
// LabelBMFont
LabelBMFont *label1 = LabelBMFont::create("Testing Glyph Designer", "fonts/futura-48.fnt");
auto label1 = LabelBMFont::create("Testing Glyph Designer", "fonts/futura-48.fnt");
addChild(label1);
label1->setPosition(Point(s.width/2, s.height/2));
}
@ -916,8 +911,8 @@ std::string LabelGlyphDesigner::subtitle()
void AtlasTestScene::runThisTest()
{
sceneIdx = -1;
Layer* pLayer = nextAtlasAction();
addChild(pLayer);
Layer* layer = nextAtlasAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}
@ -932,7 +927,7 @@ LabelTTFTest::LabelTTFTest()
Size blockSize = Size(200, 160);
Size s = Director::getInstance()->getWinSize();
LayerColor *colorLayer = LayerColor::create(Color4B(100, 100, 100, 255), blockSize.width, blockSize.height);
auto colorLayer = LayerColor::create(Color4B(100, 100, 100, 255), blockSize.width, blockSize.height);
colorLayer->setAnchorPoint(Point(0,0));
colorLayer->setPosition(Point((s.width - blockSize.width) / 2, (s.height - blockSize.height) / 2));
@ -1095,10 +1090,10 @@ string LabelTTFMultiline::subtitle()
LabelTTFChinese::LabelTTFChinese()
{
Size size = Director::getInstance()->getWinSize();
LabelTTF *pLable = LabelTTF::create("中国", "Marker Felt", 30);
pLable->setPosition(Point(size.width / 2, size.height /2));
this->addChild(pLable);
auto size = Director::getInstance()->getWinSize();
auto label = LabelTTF::create("中国", "Marker Felt", 30);
label->setPosition(Point(size.width / 2, size.height /2));
this->addChild(label);
}
string LabelTTFChinese::title()
@ -1108,10 +1103,10 @@ string LabelTTFChinese::title()
LabelBMFontChinese::LabelBMFontChinese()
{
Size size = Director::getInstance()->getWinSize();
LabelBMFont* pLable = LabelBMFont::create("中国", "fonts/bitmapFontChinese.fnt");
pLable->setPosition(Point(size.width / 2, size.height /2));
this->addChild(pLable);
auto size = Director::getInstance()->getWinSize();
auto label = LabelBMFont::create("中国", "fonts/bitmapFontChinese.fnt");
label->setPosition(Point(size.width / 2, size.height /2));
this->addChild(label);
}
string LabelBMFontChinese::title()
@ -1155,10 +1150,10 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
this->_arrowsShouldRetain->retain();
MenuItemFont::setFontSize(20);
MenuItemFont *longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
MenuItemFont *lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
MenuItemFont *mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
Menu *stringMenu = Menu::create(longSentences, lineBreaks, mixed, NULL);
auto longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
auto lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
auto mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, NULL);
stringMenu->alignItemsVertically();
longSentences->setColor(Color3B::RED);
@ -1169,10 +1164,10 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
MenuItemFont::setFontSize(30);
MenuItemFont *left = MenuItemFont::create("Left", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
MenuItemFont *center = MenuItemFont::create("Center", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
MenuItemFont *right = MenuItemFont::create("Right", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
Menu *alignmentMenu = Menu::create(left, center, right, NULL);
auto left = MenuItemFont::create("Left", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
auto center = MenuItemFont::create("Center", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
auto right = MenuItemFont::create("Right", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
auto alignmentMenu = Menu::create(left, center, right, NULL);
alignmentMenu->alignItemsHorizontallyWithPadding(alignmentItemPadding);
center->setColor(Color3B::RED);
@ -1247,7 +1242,7 @@ void BitmapFontMultiLineAlignment::stringChanged(cocos2d::Object *sender)
void BitmapFontMultiLineAlignment::alignmentChanged(cocos2d::Object *sender)
{
MenuItemFont *item = (MenuItemFont*)sender;
MenuItemFont *item = static_cast<MenuItemFont*>(sender);
item->setColor(Color3B::RED);
this->_lastAlignmentItem->setColor(Color3B::WHITE);
this->_lastAlignmentItem = item;
@ -1331,10 +1326,10 @@ LabelTTFA8Test::LabelTTFA8Test()
label1->setColor(Color3B::RED);
label1->setPosition(Point(s.width/2, s.height/2));
FadeOut *fadeOut = FadeOut::create(2);
FadeIn *fadeIn = FadeIn::create(2);
Sequence *seq = Sequence::create(fadeOut, fadeIn, NULL);
RepeatForever *forever = RepeatForever::create(seq);
auto fadeOut = FadeOut::create(2);
auto fadeIn = FadeIn::create(2);
auto seq = Sequence::create(fadeOut, fadeIn, NULL);
auto forever = RepeatForever::create(seq);
label1->runAction(forever);
}
@ -1353,11 +1348,11 @@ BMFontOneAtlas::BMFontOneAtlas()
{
Size s = Director::getInstance()->getWinSize();
LabelBMFont *label1 = LabelBMFont::create("This is Helvetica", "fonts/helvetica-32.fnt", kLabelAutomaticWidth, kTextAlignmentLeft, Point::ZERO);
auto label1 = LabelBMFont::create("This is Helvetica", "fonts/helvetica-32.fnt", kLabelAutomaticWidth, kTextAlignmentLeft, Point::ZERO);
addChild(label1);
label1->setPosition(Point(s.width/2, s.height/3*2));
LabelBMFont *label2 = LabelBMFont::create("And this is Geneva", "fonts/geneva-32.fnt", kLabelAutomaticWidth, kTextAlignmentLeft, Point(0, 128));
auto label2 = LabelBMFont::create("And this is Geneva", "fonts/geneva-32.fnt", kLabelAutomaticWidth, kTextAlignmentLeft, Point(0, 128));
addChild(label2);
label2->setPosition(Point(s.width/2, s.height/3*1));
}
@ -1377,27 +1372,26 @@ BMFontUnicode::BMFontUnicode()
{
Dictionary *strings = Dictionary::createWithContentsOfFile("fonts/strings.xml");
const char *chinese = ((String*)strings->objectForKey("chinese1"))->_string.c_str();
const char *japanese = ((String*)strings->objectForKey("japanese"))->_string.c_str();
const char *russian = ((String*)strings->objectForKey("russian"))->_string.c_str();
const char *spanish = ((String*)strings->objectForKey("spanish"))->_string.c_str();
const char *chinese = static_cast<String*>(strings->objectForKey("chinese1"))->_string.c_str();
const char *japanese = static_cast<String*>(strings->objectForKey("japanese"))->_string.c_str();
const char *russian = static_cast<String*>(strings->objectForKey("russian"))->_string.c_str();
const char *spanish = static_cast<String*>(strings->objectForKey("spanish"))->_string.c_str();
Size s = Director::getInstance()->getWinSize();
LabelBMFont *label1 = LabelBMFont::create(spanish, "fonts/arial-unicode-26.fnt", 200, kTextAlignmentLeft);
auto label1 = LabelBMFont::create(spanish, "fonts/arial-unicode-26.fnt", 200, kTextAlignmentLeft);
addChild(label1);
label1->setPosition(Point(s.width/2, s.height/5*4));
LabelBMFont *label2 = LabelBMFont::create(chinese, "fonts/arial-unicode-26.fnt");
auto label2 = LabelBMFont::create(chinese, "fonts/arial-unicode-26.fnt");
addChild(label2);
label2->setPosition(Point(s.width/2, s.height/5*3));
LabelBMFont *label3 = LabelBMFont::create(russian, "fonts/arial-26-en-ru.fnt");
auto label3 = LabelBMFont::create(russian, "fonts/arial-26-en-ru.fnt");
addChild(label3);
label3->setPosition(Point(s.width/2, s.height/5*2));
LabelBMFont *label4 = LabelBMFont::create(japanese, "fonts/arial-unicode-26.fnt");
auto label4 = LabelBMFont::create(japanese, "fonts/arial-unicode-26.fnt");
addChild(label4);
label4->setPosition(Point(s.width/2, s.height/5*1));
}
@ -1418,10 +1412,8 @@ BMFontInit::BMFontInit()
{
Size s = Director::getInstance()->getWinSize();
LabelBMFont* bmFont = new LabelBMFont();
bmFont->init();
bmFont->autorelease();
//CCLabelBMFont* bmFont = [LabelBMFont create:@"Foo" fntFile:@"arial-unicode-26.fnt"];
LabelBMFont* bmFont = LabelBMFont::create();
bmFont->setFntFile("fonts/helvetica-32.fnt");
bmFont->setString("It is working!");
this->addChild(bmFont);
@ -1430,12 +1422,12 @@ BMFontInit::BMFontInit()
std::string BMFontInit::title()
{
return "CCLabelBMFont init";
return "LabelBMFont create()";
}
std::string BMFontInit::subtitle()
{
return "Test for support of init method without parameters.";
return "Testing LabelBMFont::create() wihtout params";
}
// TTFFontInit
@ -1444,9 +1436,8 @@ TTFFontInit::TTFFontInit()
{
Size s = Director::getInstance()->getWinSize();
LabelTTF* font = new LabelTTF();
font->init();
font->autorelease();
LabelTTF* font = LabelTTF::create();
font->setFontName("Marker Felt");
font->setFontSize(48);
font->setString("It is working!");
@ -1456,12 +1447,12 @@ TTFFontInit::TTFFontInit()
std::string TTFFontInit::title()
{
return "CCLabelTTF init";
return "LabelTTF create()";
}
std::string TTFFontInit::subtitle()
{
return "Test for support of init method without parameters.";
return "Testing LabelTTF::create() wihtout params";
}
TTFFontShadowAndStroke::TTFFontShadowAndStroke()
@ -1496,8 +1487,7 @@ TTFFontShadowAndStroke::TTFFontShadowAndStroke()
this->addChild(fontShadow);
fontShadow->setPosition(Point(s.width/2,s.height/4*2.5));
// create the stroke only label
FontDefinition strokeTextDef;
strokeTextDef._fontSize = 20;
@ -1541,9 +1531,6 @@ TTFFontShadowAndStroke::TTFFontShadowAndStroke()
// add label to the scene
this->addChild(fontStrokeAndShadow);
fontStrokeAndShadow->setPosition(Point(s.width/2,s.height/4*1.1));
}
std::string TTFFontShadowAndStroke::title()
@ -1563,14 +1550,14 @@ Issue1343::Issue1343()
{
Size s = Director::getInstance()->getWinSize();
LabelBMFont* bmFont = new LabelBMFont();
bmFont->init();
LabelBMFont* bmFont = LabelBMFont::create();
bmFont->setFntFile("fonts/font-issue1343.fnt");
bmFont->setString("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz.,'");
this->addChild(bmFont);
bmFont->release();
bmFont->setScale(0.3f);
this->addChild(bmFont);
bmFont->setScale(0.3f);
bmFont->setPosition(Point(s.width/2,s.height/4*2));
}

View File

@ -33,10 +33,10 @@ static Layer* nextAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction()
@ -46,18 +46,18 @@ static Layer* backAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
//------------------------------------------------------------------
@ -716,9 +716,9 @@ void LayerIgnoreAnchorPointPos::onEnter()
void LayerIgnoreAnchorPointPos::onToggle(Object* pObject)
{
Node* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->isIgnoreAnchorPointForPosition();
pLayer->ignoreAnchorPointForPosition(! ignore);
Node* layer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = layer->isIgnoreAnchorPointForPosition();
layer->ignoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointPos::title()
@ -764,9 +764,9 @@ void LayerIgnoreAnchorPointRot::onEnter()
void LayerIgnoreAnchorPointRot::onToggle(Object* pObject)
{
Node* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->isIgnoreAnchorPointForPosition();
pLayer->ignoreAnchorPointForPosition(! ignore);
Node* layer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = layer->isIgnoreAnchorPointForPosition();
layer->ignoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointRot::title()
@ -815,9 +815,9 @@ void LayerIgnoreAnchorPointScale::onEnter()
void LayerIgnoreAnchorPointScale::onToggle(Object* pObject)
{
Node* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->isIgnoreAnchorPointForPosition();
pLayer->ignoreAnchorPointForPosition(! ignore);
Node* layer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = layer->isIgnoreAnchorPointForPosition();
layer->ignoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointScale::title()
@ -833,8 +833,8 @@ std::string LayerIgnoreAnchorPointScale::subtitle()
void LayerTestScene::runThisTest()
{
sceneIdx = -1;
Layer* pLayer = nextAction();
addChild(pLayer);
Layer* layer = nextAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -148,8 +148,8 @@ void MenuLayerMainMenu::menuCallbackConfig(Object* sender)
void MenuLayerMainMenu::allowTouches(float dt)
{
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->setPriority(kMenuHandlerPriority+1, this);
Director* director = Director::getInstance();
director->getTouchDispatcher()->setPriority(kMenuHandlerPriority+1, this);
unscheduleAllSelectors();
CCLog("TOUCHES ALLOWED AGAIN");
}
@ -157,8 +157,8 @@ void MenuLayerMainMenu::allowTouches(float dt)
void MenuLayerMainMenu::menuCallbackDisabled(Object* sender)
{
// hijack all touch events for 5 seconds
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->setPriority(kMenuHandlerPriority-1, this);
Director* director = Director::getInstance();
director->getTouchDispatcher()->setPriority(kMenuHandlerPriority-1, this);
schedule(schedule_selector(MenuLayerMainMenu::allowTouches), 5.0f);
CCLog("TOUCHES DISABLED FOR 5 SECONDS");
}
@ -512,7 +512,7 @@ MenuLayerPriorityTest::~MenuLayerPriorityTest()
void MenuLayerPriorityTest::menuCallback(Object* pSender)
{
static_cast<LayerMultiplex*>(_parent)->switchTo(0);
// [[Director sharedDirector] popScene];
// [[Director sharedDirector] poscene];
}
// BugsTest
@ -607,24 +607,24 @@ void RemoveMenuItemWhenMove::ccTouchMoved(Touch *pTouch, Event *pEvent)
void MenuTestScene::runThisTest()
{
Layer* pLayer1 = new MenuLayerMainMenu();
Layer* pLayer2 = new MenuLayer2();
Layer* pLayer3 = new MenuLayer3();
Layer* pLayer4 = new MenuLayer4();
Layer* pLayer5 = new MenuLayerPriorityTest();
Layer* pLayer6 = new BugsTest();
Layer* pLayer7 = new RemoveMenuItemWhenMove();
Layer* layer1 = new MenuLayerMainMenu();
Layer* layer2 = new MenuLayer2();
Layer* layer3 = new MenuLayer3();
Layer* layer4 = new MenuLayer4();
Layer* layer5 = new MenuLayerPriorityTest();
Layer* layer6 = new BugsTest();
Layer* layer7 = new RemoveMenuItemWhenMove();
LayerMultiplex* layer = LayerMultiplex::create(pLayer1, pLayer2, pLayer3, pLayer4, pLayer5, pLayer6, pLayer7, NULL);
LayerMultiplex* layer = LayerMultiplex::create(layer1, layer2, layer3, layer4, layer5, layer6, layer7, NULL);
addChild(layer, 0);
pLayer1->release();
pLayer2->release();
pLayer3->release();
pLayer4->release();
pLayer5->release();
pLayer6->release();
pLayer7->release();
layer1->release();
layer2->release();
layer3->release();
layer4->release();
layer5->release();
layer6->release();
layer7->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -11,6 +11,48 @@ Layer* nextMotionAction();
Layer* backMotionAction();
Layer* restartMotionAction();
static int sceneIdx = -1;
static std::function<Layer*()> createFunctions[] =
{
CL(MotionStreakTest1),
CL(MotionStreakTest2),
CL(Issue1358),
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
Layer* nextMotionAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return layer;
}
Layer* backMotionAction()
{
sceneIdx--;
int total = MAX_LAYER;
if( sceneIdx < 0 )
sceneIdx += total;
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return layer;
}
Layer* restartMotionAction()
{
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return layer;
}
//------------------------------------------------------------------
//
// MotionStreakTest1
@ -151,62 +193,6 @@ std::string Issue1358::subtitle()
//
//------------------------------------------------------------------
// enum
// {
// IDC_NEXT = 100,
// IDC_BACK,
// IDC_RESTART
// };
static int sceneIdx = -1;
#define MAX_LAYER 3
Layer* createMotionLayer(int nIndex)
{
switch(nIndex)
{
case 0: return new MotionStreakTest1();
case 1: return new MotionStreakTest2();
case 2: return new Issue1358();
}
return NULL;
}
Layer* nextMotionAction()
{
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createMotionLayer(sceneIdx);
pLayer->autorelease();
return pLayer;
}
Layer* backMotionAction()
{
sceneIdx--;
int total = MAX_LAYER;
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createMotionLayer(sceneIdx);
pLayer->autorelease();
return pLayer;
}
Layer* restartMotionAction()
{
Layer* pLayer = createMotionLayer(sceneIdx);
pLayer->autorelease();
return pLayer;
}
MotionStreakTest::MotionStreakTest(void)
{
}
@ -275,8 +261,8 @@ void MotionStreakTest::backCallback(Object* pSender)
void MotionStreakTestScene::runThisTest()
{
Layer* pLayer = nextMotionAction();
addChild(pLayer);
Layer* layer = nextMotionAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -117,9 +117,9 @@ void MutiTouchTestLayer::ccTouchesCancelled(Set *pTouches, Event *pEvent)
void MutiTouchTestScene::runThisTest()
{
MutiTouchTestLayer* pLayer = MutiTouchTestLayer::create();
MutiTouchTestLayer* layer = MutiTouchTestLayer::create();
addChild(pLayer, 0);
addChild(layer, 0);
Director::getInstance()->replaceScene(this);
}

View File

@ -52,10 +52,10 @@ Layer* nextCocosNodeAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createCocosNodeLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createCocosNodeLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backCocosNodeAction()
@ -65,18 +65,18 @@ Layer* backCocosNodeAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createCocosNodeLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createCocosNodeLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartCocosNodeAction()
{
Layer* pLayer = createCocosNodeLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createCocosNodeLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
@ -841,8 +841,8 @@ std::string NodeNonOpaqueTest::subtitle()
void CocosNodeTestScene::runThisTest()
{
Layer* pLayer = nextCocosNodeAction();
addChild(pLayer);
Layer* layer = nextCocosNodeAction();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -173,10 +173,10 @@ Layer* nextParallaxAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createParallaxTestLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createParallaxTestLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backParallaxAction()
@ -186,18 +186,18 @@ Layer* backParallaxAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createParallaxTestLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createParallaxTestLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartParallaxAction()
{
Layer* pLayer = createParallaxTestLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createParallaxTestLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
@ -246,8 +246,8 @@ void ParallaxDemo::backCallback(Object* pSender)
void ParallaxTestScene::runThisTest()
{
Layer* pLayer = nextParallaxAction();
Layer* layer = nextParallaxAction();
addChild(pLayer);
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -1033,10 +1033,10 @@ Layer* nextParticleAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createParticleLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createParticleLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backParticleAction()
@ -1046,18 +1046,18 @@ Layer* backParticleAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createParticleLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createParticleLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartParticleAction()
{
Layer* pLayer = createParticleLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createParticleLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
ParticleDemo::~ParticleDemo(void)

View File

@ -31,34 +31,34 @@ NodeChildrenMenuLayer::NodeChildrenMenuLayer(bool bControlMenuVisible, int nMaxC
void NodeChildrenMenuLayer::showCurrentTest()
{
int nNodes = ((NodeChildrenMainScene*)getParent())->getQuantityOfNodes();
NodeChildrenMainScene* pScene = NULL;
NodeChildrenMainScene* scene = NULL;
switch (_curCase)
{
// case 0:
// pScene = new IterateSpriteSheetFastEnum();
// scene = new IterateSpriteSheetFastEnum();
// break;
case 0:
pScene = new IterateSpriteSheetCArray();
scene = new IterateSpriteSheetCArray();
break;
case 1:
pScene = new AddSpriteSheet();
scene = new AddSpriteSheet();
break;
case 2:
pScene = new RemoveSpriteSheet();
scene = new RemoveSpriteSheet();
break;
case 3:
pScene = new ReorderSpriteSheet();
scene = new ReorderSpriteSheet();
break;
}
s_nCurCase = _curCase;
if (pScene)
if (scene)
{
pScene->initWithQuantityOfNodes(nNodes);
scene->initWithQuantityOfNodes(nNodes);
Director::getInstance()->replaceScene(pScene);
pScene->release();
Director::getInstance()->replaceScene(scene);
scene->release();
}
}
@ -220,8 +220,8 @@ void IterateSpriteSheetFastEnum::update(float dt)
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* pSprite = static_cast<Sprite*>(pObject);
pSprite->setVisible(false);
Sprite* scene = static_cast<Sprite*>(pObject);
scene->setVisible(false);
}
CC_PROFILER_STOP_INSTANCE(this, this->profilerName());
@ -257,8 +257,8 @@ void IterateSpriteSheetCArray::update(float dt)
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* pSprite = static_cast<Sprite*>(pObject);
pSprite->setVisible(false);
Sprite* scene = static_cast<Sprite*>(pObject);
scene->setVisible(false);
}
CC_PROFILER_STOP(this->profilerName());
@ -354,8 +354,8 @@ void AddSpriteSheet::update(float dt)
// Don't include the sprite creation time and random as part of the profiling
for(int i=0; i<totalToAdd; i++)
{
Sprite* pSprite = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(pSprite);
Sprite* scene = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(scene);
zs[i] = CCRANDOM_MINUS1_1() * 50;
}
@ -415,8 +415,8 @@ void RemoveSpriteSheet::update(float dt)
// Don't include the sprite creation time as part of the profiling
for(int i=0;i<totalToAdd;i++)
{
Sprite* pSprite = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(pSprite);
Sprite* scene = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(scene);
}
// add them with random Z (very important!)
@ -471,8 +471,8 @@ void ReorderSpriteSheet::update(float dt)
// Don't include the sprite creation time as part of the profiling
for(int i=0;i<totalToAdd;i++)
{
Sprite* pSprite = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(pSprite);
Sprite* scene = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(scene);
}
// add them with random Z (very important!)
@ -488,8 +488,8 @@ void ReorderSpriteSheet::update(float dt)
for( int i=0;i < totalToAdd;i++)
{
Node* pNode = (Node*) (batchNode->getChildren()->objectAtIndex(i));
batchNode->reorderChild(pNode, CCRANDOM_MINUS1_1() * 50);
Node* node = (Node*) (batchNode->getChildren()->objectAtIndex(i));
batchNode->reorderChild(node, CCRANDOM_MINUS1_1() * 50);
}
batchNode->sortAllChildren();
@ -520,9 +520,9 @@ const char* ReorderSpriteSheet::profilerName()
void runNodeChildrenTest()
{
IterateSpriteSheet* pScene = new IterateSpriteSheetCArray();
pScene->initWithQuantityOfNodes(kNodesIncrease);
IterateSpriteSheet* scene = new IterateSpriteSheetCArray();
scene->initWithQuantityOfNodes(kNodesIncrease);
Director::getInstance()->replaceScene(pScene);
pScene->release();
Director::getInstance()->replaceScene(scene);
scene->release();
}

View File

@ -31,9 +31,9 @@ ParticleMenuLayer::ParticleMenuLayer(bool bControlMenuVisible, int nMaxCases, in
void ParticleMenuLayer::showCurrentTest()
{
ParticleMainScene* pScene = (ParticleMainScene*)getParent();
int subTest = pScene->getSubTestNum();
int parNum = pScene->getParticlesNum();
ParticleMainScene* scene = (ParticleMainScene*)getParent();
int subTest = scene->getSubTestNum();
int parNum = scene->getParticlesNum();
ParticleMainScene* pNewScene = NULL;
@ -559,9 +559,9 @@ void ParticlePerformTest4::doTest()
void runParticleTest()
{
ParticleMainScene* pScene = new ParticlePerformTest1;
pScene->initWithSubTest(1, kNodesIncrease);
ParticleMainScene* scene = new ParticlePerformTest1;
scene->initWithSubTest(1, kNodesIncrease);
Director::getInstance()->replaceScene(pScene);
pScene->release();
Director::getInstance()->replaceScene(scene);
scene->release();
}

View File

@ -229,7 +229,7 @@ void SubTest::removeByTag(int tag)
////////////////////////////////////////////////////////
void SpriteMenuLayer::showCurrentTest()
{
SpriteMainScene* pScene = NULL;
SpriteMainScene* scene = NULL;
SpriteMainScene* pPreScene = (SpriteMainScene*) getParent();
int nSubTest = pPreScene->getSubTestNum();
int nNodes = pPreScene->getNodesNum();
@ -237,34 +237,34 @@ void SpriteMenuLayer::showCurrentTest()
switch (_curCase)
{
case 0:
pScene = new SpritePerformTest1;
scene = new SpritePerformTest1;
break;
case 1:
pScene = new SpritePerformTest2;
scene = new SpritePerformTest2;
break;
case 2:
pScene = new SpritePerformTest3;
scene = new SpritePerformTest3;
break;
case 3:
pScene = new SpritePerformTest4;
scene = new SpritePerformTest4;
break;
case 4:
pScene = new SpritePerformTest5;
scene = new SpritePerformTest5;
break;
case 5:
pScene = new SpritePerformTest6;
scene = new SpritePerformTest6;
break;
case 6:
pScene = new SpritePerformTest7;
scene = new SpritePerformTest7;
break;
}
s_nSpriteCurCase = _curCase;
if (pScene)
if (scene)
{
pScene->initWithSubTest(nSubTest, nNodes);
Director::getInstance()->replaceScene(pScene);
pScene->release();
scene->initWithSubTest(nSubTest, nNodes);
Director::getInstance()->replaceScene(scene);
scene->release();
}
}
@ -408,77 +408,77 @@ void SpriteMainScene::onDecrease(Object* pSender)
// For test functions
//
////////////////////////////////////////////////////////
void performanceActions(Sprite* pSprite)
void performanceActions(Sprite* scene)
{
Size size = Director::getInstance()->getWinSize();
pSprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
float period = 0.5f + (rand() % 1000) / 500.0f;
RotateBy* rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1());
ActionInterval* rot_back = rot->reverse();
Action *permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL));
pSprite->runAction(permanentRotation);
scene->runAction(permanentRotation);
float growDuration = 0.5f + (rand() % 1000) / 500.0f;
ActionInterval *grow = ScaleBy::create(growDuration, 0.5f, 0.5f);
Action *permanentScaleLoop = RepeatForever::create(Sequence::create(grow, grow->reverse(), NULL));
pSprite->runAction(permanentScaleLoop);
scene->runAction(permanentScaleLoop);
}
void performanceActions20(Sprite* pSprite)
void performanceActions20(Sprite* scene)
{
Size size = Director::getInstance()->getWinSize();
if( CCRANDOM_0_1() < 0.2f )
pSprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
else
pSprite->setPosition(Point( -1000, -1000));
scene->setPosition(Point( -1000, -1000));
float period = 0.5f + (rand() % 1000) / 500.0f;
RotateBy* rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1());
ActionInterval* rot_back = rot->reverse();
Action *permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL));
pSprite->runAction(permanentRotation);
scene->runAction(permanentRotation);
float growDuration = 0.5f + (rand() % 1000) / 500.0f;
ActionInterval *grow = ScaleBy::create(growDuration, 0.5f, 0.5f);
Action *permanentScaleLoop = RepeatForever::create(Sequence::createWithTwoActions(grow, grow->reverse()));
pSprite->runAction(permanentScaleLoop);
scene->runAction(permanentScaleLoop);
}
void performanceRotationScale(Sprite* pSprite)
void performanceRotationScale(Sprite* scene)
{
Size size = Director::getInstance()->getWinSize();
pSprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
pSprite->setRotation(CCRANDOM_0_1() * 360);
pSprite->setScale(CCRANDOM_0_1() * 2);
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setRotation(CCRANDOM_0_1() * 360);
scene->setScale(CCRANDOM_0_1() * 2);
}
void performancePosition(Sprite* pSprite)
void performancePosition(Sprite* scene)
{
Size size = Director::getInstance()->getWinSize();
pSprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
}
void performanceout20(Sprite* pSprite)
void performanceout20(Sprite* scene)
{
Size size = Director::getInstance()->getWinSize();
if( CCRANDOM_0_1() < 0.2f )
pSprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
else
pSprite->setPosition(Point( -1000, -1000));
scene->setPosition(Point( -1000, -1000));
}
void performanceOut100(Sprite* pSprite)
void performanceOut100(Sprite* scene)
{
pSprite->setPosition(Point( -1000, -1000));
scene->setPosition(Point( -1000, -1000));
}
void performanceScale(Sprite* pSprite)
void performanceScale(Sprite* scene)
{
Size size = Director::getInstance()->getWinSize();
pSprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
pSprite->setScale(CCRANDOM_0_1() * 100 / 50);
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setScale(CCRANDOM_0_1() * 100 / 50);
}
////////////////////////////////////////////////////////
@ -609,8 +609,8 @@ void SpritePerformTest7::doTest(Sprite* sprite)
void runSpriteTest()
{
SpriteMainScene* pScene = new SpritePerformTest1;
pScene->initWithSubTest(1, 50);
Director::getInstance()->replaceScene(pScene);
pScene->release();
SpriteMainScene* scene = new SpritePerformTest1;
scene->initWithSubTest(1, 50);
Director::getInstance()->replaceScene(scene);
scene->release();
}

View File

@ -93,10 +93,10 @@ void PerformBasicLayer::onEnter()
void PerformBasicLayer::toMainLayer(Object* pSender)
{
PerformanceTestScene* pScene = new PerformanceTestScene();
pScene->runThisTest();
PerformanceTestScene* scene = new PerformanceTestScene();
scene->runThisTest();
pScene->release();
scene->release();
}
void PerformBasicLayer::restartCallback(Object* pSender)
@ -129,9 +129,9 @@ void PerformBasicLayer::backCallback(Object* pSender)
void PerformanceTestScene::runThisTest()
{
Layer* pLayer = new PerformanceMainLayer();
addChild(pLayer);
pLayer->release();
Layer* layer = new PerformanceMainLayer();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -25,19 +25,19 @@ float calculateDeltaTime( struct timeval *lastUpdate )
////////////////////////////////////////////////////////
void TextureMenuLayer::showCurrentTest()
{
Scene* pScene = NULL;
Scene* scene = NULL;
switch (_curCase)
{
case 0:
pScene = TextureTest::scene();
scene = TextureTest::scene();
break;
}
s_nTexCurCase = _curCase;
if (pScene)
if (scene)
{
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}
@ -344,17 +344,17 @@ std::string TextureTest::subtitle()
Scene* TextureTest::scene()
{
Scene *pScene = Scene::create();
Scene *scene = Scene::create();
TextureTest *layer = new TextureTest(false, TEST_COUNT, s_nTexCurCase);
pScene->addChild(layer);
scene->addChild(layer);
layer->release();
return pScene;
return scene;
}
void runTextureTest()
{
s_nTexCurCase = 0;
Scene* pScene = TextureTest::scene();
Director::getInstance()->replaceScene(pScene);
Scene* scene = TextureTest::scene();
Director::getInstance()->replaceScene(scene);
}

View File

@ -14,25 +14,25 @@ static int s_nTouchCurCase = 0;
////////////////////////////////////////////////////////
void TouchesMainScene::showCurrentTest()
{
Layer* pLayer = NULL;
Layer* layer = NULL;
switch (_curCase)
{
case 0:
pLayer = new TouchesPerformTest1(true, TEST_COUNT, _curCase);
layer = new TouchesPerformTest1(true, TEST_COUNT, _curCase);
break;
case 1:
pLayer = new TouchesPerformTest2(true, TEST_COUNT, _curCase);
layer = new TouchesPerformTest2(true, TEST_COUNT, _curCase);
break;
}
s_nTouchCurCase = _curCase;
if (pLayer)
if (layer)
{
Scene* pScene = Scene::create();
pScene->addChild(pLayer);
pLayer->release();
Scene* scene = Scene::create();
scene->addChild(layer);
layer->release();
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}
@ -99,8 +99,8 @@ std::string TouchesPerformTest1::title()
void TouchesPerformTest1::registerWithTouchDispatcher()
{
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
Director* director = Director::getInstance();
director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
}
bool TouchesPerformTest1::ccTouchBegan(Touch* touch, Event* event)
@ -142,8 +142,8 @@ std::string TouchesPerformTest2::title()
void TouchesPerformTest2::registerWithTouchDispatcher()
{
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->addStandardDelegate(this, 0);
Director* director = Director::getInstance();
director->getTouchDispatcher()->addStandardDelegate(this, 0);
}
void TouchesPerformTest2::ccTouchesBegan(Set* touches, Event* event)
@ -168,11 +168,11 @@ void TouchesPerformTest2::ccTouchesCancelled(Set* touches, Event* event)
void runTouchesTest()
{
s_nTouchCurCase = 0;
Scene* pScene = Scene::create();
Layer* pLayer = new TouchesPerformTest1(true, TEST_COUNT, s_nTouchCurCase);
Scene* scene = Scene::create();
Layer* layer = new TouchesPerformTest1(true, TEST_COUNT, s_nTouchCurCase);
pScene->addChild(pLayer);
pLayer->release();
scene->addChild(layer);
layer->release();
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}

View File

@ -23,10 +23,10 @@ static Layer* nextTestCase()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backTestCase()
@ -36,18 +36,18 @@ static Layer* backTestCase()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartTestCase()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->autorelease();
return pLayer;
return layer;
}
void RenderTextureTest::onEnter()
@ -284,8 +284,8 @@ std::string RenderTextureIssue937::subtitle()
void RenderTextureScene::runThisTest()
{
Layer* pLayer = nextTestCase();
addChild(pLayer);
Layer* layer = nextTestCase();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -126,9 +126,9 @@ void RotateWorldMainLayer::onEnter()
void RotateWorldTestScene::runThisTest()
{
Layer* pLayer = RotateWorldMainLayer::create();
Layer* layer = RotateWorldMainLayer::create();
addChild(pLayer);
addChild(layer);
runAction( RotateBy::create(4, -360) );
Director::getInstance()->replaceScene(this);

View File

@ -63,29 +63,29 @@ SceneTestLayer1::~SceneTestLayer1()
void SceneTestLayer1::onPushScene(Object* pSender)
{
Scene* scene = new SceneTestScene();
Layer* pLayer = new SceneTestLayer2();
scene->addChild( pLayer, 0 );
Layer* layer = new SceneTestLayer2();
scene->addChild( layer, 0 );
Director::getInstance()->pushScene( scene );
scene->release();
pLayer->release();
layer->release();
}
void SceneTestLayer1::onPushSceneTran(Object* pSender)
{
Scene* scene = new SceneTestScene();
Layer* pLayer = new SceneTestLayer2();
scene->addChild( pLayer, 0 );
Layer* layer = new SceneTestLayer2();
scene->addChild( layer, 0 );
Director::getInstance()->pushScene( TransitionSlideInT::create(1, scene) );
scene->release();
pLayer->release();
layer->release();
}
void SceneTestLayer1::onQuit(Object* pSender)
{
//getCocosApp()->exit();
//CCDirector::getInstance()->popScene();
//CCDirector::getInstance()->poscene();
//// HA HA... no more terminate on sdk v3.0
//// http://developer.apple.com/iphone/library/qa/qa2008/qa1561.html
@ -137,21 +137,21 @@ void SceneTestLayer2::onGoBack(Object* pSender)
void SceneTestLayer2::onReplaceScene(Object* pSender)
{
Scene* pScene = new SceneTestScene();
Layer* pLayer = SceneTestLayer3::create();
pScene->addChild( pLayer, 0 );
Director::getInstance()->replaceScene( pScene );
pScene->release();
Scene* scene = new SceneTestScene();
Layer* layer = SceneTestLayer3::create();
scene->addChild( layer, 0 );
Director::getInstance()->replaceScene( scene );
scene->release();
}
void SceneTestLayer2::onReplaceSceneTran(Object* pSender)
{
Scene* pScene = new SceneTestScene();
Layer* pLayer = SceneTestLayer3::create();
pScene->addChild( pLayer, 0 );
Director::getInstance()->replaceScene( TransitionFlipX::create(2, pScene) );
pScene->release();
Scene* scene = new SceneTestScene();
Layer* layer = SceneTestLayer3::create();
scene->addChild( layer, 0 );
Director::getInstance()->replaceScene( TransitionFlipX::create(2, scene) );
scene->release();
}
//------------------------------------------------------------------
@ -172,7 +172,7 @@ bool SceneTestLayer3::init()
Size s = Director::getInstance()->getWinSize();
MenuItemFont *item0 = MenuItemFont::create("Touch to pushScene (self)", CC_CALLBACK_1(SceneTestLayer3::item0Clicked, this));
MenuItemFont *item1 = MenuItemFont::create("Touch to popScene", CC_CALLBACK_1(SceneTestLayer3::item1Clicked, this));
MenuItemFont *item1 = MenuItemFont::create("Touch to poscene", CC_CALLBACK_1(SceneTestLayer3::item1Clicked, this));
MenuItemFont *item2 = MenuItemFont::create("Touch to popToRootScene", CC_CALLBACK_1(SceneTestLayer3::item2Clicked, this));
MenuItemFont *item3 = MenuItemFont::create("Touch to popToSceneStackLevel(2)", CC_CALLBACK_1(SceneTestLayer3::item3Clicked, this));
@ -222,9 +222,9 @@ void SceneTestLayer3::item3Clicked(Object* pSender)
void SceneTestScene::runThisTest()
{
Layer* pLayer = new SceneTestLayer1();
addChild(pLayer);
pLayer->release();
Layer* layer = new SceneTestLayer1();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}

View File

@ -54,11 +54,11 @@ Layer* nextSchedulerTest()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
Layer* backSchedulerTest()
@ -68,20 +68,20 @@ Layer* backSchedulerTest()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartSchedulerTest()
{
Layer* pLayer = (createFunctions[sceneIdx])();
pLayer->init();
pLayer->autorelease();
Layer* layer = (createFunctions[sceneIdx])();
layer->init();
layer->autorelease();
return pLayer;
return layer;
}
//------------------------------------------------------------------
@ -96,32 +96,32 @@ void SchedulerTestLayer::onEnter()
void SchedulerTestLayer::backCallback(Object* pSender)
{
Scene* pScene = new SchedulerTestScene();
Layer* pLayer = backSchedulerTest();
Scene* scene = new SchedulerTestScene();
Layer* layer = backSchedulerTest();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
pScene->release();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
scene->release();
}
void SchedulerTestLayer::nextCallback(Object* pSender)
{
Scene* pScene = new SchedulerTestScene();
Layer* pLayer = nextSchedulerTest();
Scene* scene = new SchedulerTestScene();
Layer* layer = nextSchedulerTest();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
pScene->release();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
scene->release();
}
void SchedulerTestLayer::restartCallback(Object* pSender)
{
Scene* pScene = new SchedulerTestScene();
Layer* pLayer = restartSchedulerTest();
Scene* scene = new SchedulerTestScene();
Layer* layer = restartSchedulerTest();
pScene->addChild(pLayer);
Director::getInstance()->replaceScene(pScene);
pScene->release();
scene->addChild(layer);
Director::getInstance()->replaceScene(scene);
scene->release();
}
std::string SchedulerTestLayer::title()
@ -272,8 +272,8 @@ void SchedulerPauseResumeAll::tick2(float dt)
void SchedulerPauseResumeAll::pause(float dt)
{
CCLog("Pausing");
Director* pDirector = Director::getInstance();
_pausedTargets = pDirector->getScheduler()->pauseAllTargets();
Director* director = Director::getInstance();
_pausedTargets = director->getScheduler()->pauseAllTargets();
CC_SAFE_RETAIN(_pausedTargets);
unsigned int c = _pausedTargets->count();
@ -288,8 +288,8 @@ void SchedulerPauseResumeAll::pause(float dt)
void SchedulerPauseResumeAll::resume(float dt)
{
CCLog("Resuming");
Director* pDirector = Director::getInstance();
pDirector->getScheduler()->resumeTargets(_pausedTargets);
Director* director = Director::getInstance();
director->getScheduler()->resumeTargets(_pausedTargets);
CC_SAFE_RELEASE_NULL(_pausedTargets);
}
@ -358,16 +358,16 @@ void SchedulerPauseResumeAllUser::tick2(float dt)
void SchedulerPauseResumeAllUser::pause(float dt)
{
CCLog("Pausing");
Director* pDirector = Director::getInstance();
_pausedTargets = pDirector->getScheduler()->pauseAllTargetsWithMinPriority(kPriorityNonSystemMin);
Director* director = Director::getInstance();
_pausedTargets = director->getScheduler()->pauseAllTargetsWithMinPriority(kPriorityNonSystemMin);
CC_SAFE_RETAIN(_pausedTargets);
}
void SchedulerPauseResumeAllUser::resume(float dt)
{
CCLog("Resuming");
Director* pDirector = Director::getInstance();
pDirector->getScheduler()->resumeTargets(_pausedTargets);
Director* director = Director::getInstance();
director->getScheduler()->resumeTargets(_pausedTargets);
CC_SAFE_RELEASE_NULL(_pausedTargets);
}
@ -695,17 +695,17 @@ void SchedulerUpdate::onEnter()
void SchedulerUpdate::removeUpdates(float dt)
{
Array* children = getChildren();
Node* pNode;
Node* node;
Object* pObject;
CCARRAY_FOREACH(children, pObject)
{
pNode = static_cast<Node*>(pObject);
node = static_cast<Node*>(pObject);
if (! pNode)
if (! node)
{
break;
}
pNode->unscheduleAllSelectors();
node->unscheduleAllSelectors();
}
}
@ -1154,8 +1154,8 @@ std::string SchedulerIssue2268::subtitle()
//------------------------------------------------------------------
void SchedulerTestScene::runThisTest()
{
Layer* pLayer = nextSchedulerTest();
addChild(pLayer);
Layer* layer = nextSchedulerTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -29,10 +29,10 @@ static Layer* nextAction(void)
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createShaderLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createShaderLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
static Layer* backAction(void)
@ -42,18 +42,18 @@ static Layer* backAction(void)
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createShaderLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createShaderLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
static Layer* restartAction(void)
{
Layer* pLayer = createShaderLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createShaderLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}

View File

@ -39,8 +39,8 @@ using namespace std;
//------------------------------------------------------------------
void SpineTestScene::runThisTest()
{
Layer* pLayer = SpineTestLayer::create();
addChild(pLayer);
Layer* layer = SpineTestLayer::create();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -1 +1 @@
3f19315a4e995c1dd1b5eb35f7dd8e5a15632952
cde4f9e3da5d9548b91fe5ef35bdf0a42547c206

View File

@ -58,11 +58,11 @@ Layer* backTextInputTest()
return restartTextInputTest();
}
static Rect getRect(Node * pNode)
static Rect getRect(Node * node)
{
Rect rc;
rc.origin = pNode->getPosition();
rc.size = pNode->getContentSize();
rc.origin = node->getPosition();
rc.size = node->getContentSize();
rc.origin.x -= rc.size.width / 2;
rc.origin.y -= rc.size.height / 2;
return rc;
@ -103,10 +103,10 @@ void TextInputTest::backCallback(Object* pSender)
s->release();
}
void TextInputTest::addKeyboardNotificationLayer(KeyboardNotificationLayer * pLayer)
void TextInputTest::addKeyboardNotificationLayer(KeyboardNotificationLayer * layer)
{
_notificationLayer = pLayer;
addChild(pLayer);
_notificationLayer = layer;
addChild(layer);
}
std::string TextInputTest::title()
@ -131,8 +131,8 @@ KeyboardNotificationLayer::KeyboardNotificationLayer()
void KeyboardNotificationLayer::registerWithTouchDispatcher()
{
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, false);
Director* director = Director::getInstance();
director->getTouchDispatcher()->addTargetedDelegate(this, 0, false);
}
void KeyboardNotificationLayer::keyboardWillShow(IMEKeyboardNotificationInfo& info)
@ -436,9 +436,9 @@ bool TextFieldTTFActionTest::onDraw(TextFieldTTF * pSender)
return false;
}
void TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction(Node * pNode)
void TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction(Node * node)
{
this->removeChild(pNode, true);
this->removeChild(node, true);
}
//////////////////////////////////////////////////////////////////////////
@ -447,8 +447,8 @@ void TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction(Node * pNode)
void TextInputTestScene::runThisTest()
{
Layer* pLayer = nextTextInputTest();
addChild(pLayer);
Layer* layer = nextTextInputTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -20,7 +20,7 @@ public:
void backCallback(Object* pSender);
std::string title();
void addKeyboardNotificationLayer(KeyboardNotificationLayer * pLayer);
void addKeyboardNotificationLayer(KeyboardNotificationLayer * layer);
virtual void onEnter();
};
@ -76,7 +76,7 @@ class TextFieldTTFActionTest : public KeyboardNotificationLayer, public TextFiel
int _charLimit; // the textfield max char limit
public:
void callbackRemoveNodeWhenDidAction(Node * pNode);
void callbackRemoveNodeWhenDidAction(Node * node);
// KeyboardNotificationLayer
virtual std::string subtitle();

View File

@ -69,14 +69,14 @@ static unsigned int TEST_CASE_COUNT = sizeof(createFunctions) / sizeof(createFun
static int sceneIdx=-1;
Layer* createTextureTest(int index)
{
Layer* pLayer = (createFunctions[index])();;
Layer* layer = (createFunctions[index])();;
if (pLayer)
if (layer)
{
pLayer->autorelease();
layer->autorelease();
}
return pLayer;
return layer;
}
Layer* nextTextureTest();
@ -1793,8 +1793,8 @@ std::string TextureDrawInRect::subtitle()
//------------------------------------------------------------------
void TextureTestScene::runThisTest()
{
Layer* pLayer = nextTextureTest();
addChild(pLayer);
Layer* layer = nextTextureTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -129,9 +129,9 @@ void TextureCacheTest::addSprite()
void TextureCacheTestScene::runThisTest()
{
Layer* pLayer = new TextureCacheTest();
addChild(pLayer);
Layer* layer = new TextureCacheTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
pLayer->release();
layer->release();
}

View File

@ -1293,13 +1293,13 @@ TMXBug987::TMXBug987()
CCLOG("ContentSize: %f, %f", s1.width,s1.height);
Array* childs = map->getChildren();
TMXLayer* pNode;
TMXLayer* node;
Object* pObject = NULL;
CCARRAY_FOREACH(childs, pObject)
{
pNode = static_cast<TMXLayer*>(pObject);
CC_BREAK_IF(!pNode);
pNode->getTexture()->setAntiAliasTexParameters();
node = static_cast<TMXLayer*>(pObject);
CC_BREAK_IF(!node);
node->getTexture()->setAntiAliasTexParameters();
}
map->setAnchorPoint(Point(0, 0));
@ -1357,7 +1357,7 @@ static int sceneIdx = -1;
#define MAX_LAYER 28
Layer* createTileMapLayer(int nIndex)
Layer* createTileMalayer(int nIndex)
{
switch(nIndex)
{
@ -1399,10 +1399,10 @@ Layer* nextTileMapAction()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createTileMapLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createTileMalayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backTileMapAction()
@ -1412,18 +1412,18 @@ Layer* backTileMapAction()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createTileMapLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createTileMalayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartTileMapAction()
{
Layer* pLayer = createTileMapLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createTileMalayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
@ -1489,8 +1489,8 @@ void TileDemo::ccTouchesMoved(Set *pTouches, Event *pEvent)
void TileMapTestScene::runThisTest()
{
Layer* pLayer = nextTileMapAction();
addChild(pLayer);
Layer* layer = nextTileMapAction();
addChild(layer);
// fix bug #486, #419.
// "test" is the default value in Director::setGLDefaultValues()

View File

@ -35,15 +35,15 @@ bool Paddle::initWithTexture(Texture2D* aTexture)
void Paddle::onEnter()
{
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
Director* director = Director::getInstance();
director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
Sprite::onEnter();
}
void Paddle::onExit()
{
Director* pDirector = Director::getInstance();
pDirector->getTouchDispatcher()->removeDelegate(this);
Director* director = Director::getInstance();
director->getTouchDispatcher()->removeDelegate(this);
Sprite::onExit();
}

View File

@ -267,9 +267,9 @@ TransitionScene* createTransition(int nIndex, float t, Scene* s)
void TransitionsTestScene::runThisTest()
{
Layer * pLayer = new TestLayer1();
addChild(pLayer);
pLayer->release();
Layer * layer = new TestLayer1();
addChild(layer);
layer->release();
Director::getInstance()->replaceScene(this);
}
@ -322,15 +322,15 @@ void TestLayer1::restartCallback(Object* pSender)
{
Scene* s = new TransitionsTestScene();
Layer* pLayer = new TestLayer2();
s->addChild(pLayer);
Layer* layer = new TestLayer2();
s->addChild(layer);
Scene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
Scene* scene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
s->release();
pLayer->release();
if (pScene)
layer->release();
if (scene)
{
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}
@ -341,15 +341,15 @@ void TestLayer1::nextCallback(Object* pSender)
Scene* s = new TransitionsTestScene();
Layer* pLayer = new TestLayer2();
s->addChild(pLayer);
Layer* layer = new TestLayer2();
s->addChild(layer);
Scene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
Scene* scene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
s->release();
pLayer->release();
if (pScene)
layer->release();
if (scene)
{
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}
@ -362,15 +362,15 @@ void TestLayer1::backCallback(Object* pSender)
Scene* s = new TransitionsTestScene();
Layer* pLayer = new TestLayer2();
s->addChild(pLayer);
Layer* layer = new TestLayer2();
s->addChild(layer);
Scene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
Scene* scene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
s->release();
pLayer->release();
if (pScene)
layer->release();
if (scene)
{
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}
@ -451,15 +451,15 @@ void TestLayer2::restartCallback(Object* pSender)
{
Scene* s = new TransitionsTestScene();
Layer* pLayer = new TestLayer1();
s->addChild(pLayer);
Layer* layer = new TestLayer1();
s->addChild(layer);
Scene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
Scene* scene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
s->release();
pLayer->release();
if (pScene)
layer->release();
if (scene)
{
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}
@ -470,15 +470,15 @@ void TestLayer2::nextCallback(Object* pSender)
Scene* s = new TransitionsTestScene();
Layer* pLayer = new TestLayer1();
s->addChild(pLayer);
Layer* layer = new TestLayer1();
s->addChild(layer);
Scene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
Scene* scene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
s->release();
pLayer->release();
if (pScene)
layer->release();
if (scene)
{
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}
@ -491,15 +491,15 @@ void TestLayer2::backCallback(Object* pSender)
Scene* s = new TransitionsTestScene();
Layer* pLayer = new TestLayer1();
s->addChild(pLayer);
Layer* layer = new TestLayer1();
s->addChild(layer);
Scene* pScene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
Scene* scene = createTransition(s_nSceneIdx, TRANSITION_DURATION, s);
s->release();
pLayer->release();
if (pScene)
layer->release();
if (scene)
{
Director::getInstance()->replaceScene(pScene);
Director::getInstance()->replaceScene(scene);
}
}

View File

@ -97,9 +97,9 @@ UserDefaultTest::~UserDefaultTest()
void UserDefaultTestScene::runThisTest()
{
Layer* pLayer = new UserDefaultTest();
addChild(pLayer);
Layer* layer = new UserDefaultTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
pLayer->release();
layer->release();
}

View File

@ -24,10 +24,10 @@ Layer* nextZwoptexTest()
sceneIdx++;
sceneIdx = sceneIdx % MAX_LAYER;
Layer* pLayer = createZwoptexLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createZwoptexLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* backZwoptexTest()
@ -37,18 +37,18 @@ Layer* backZwoptexTest()
if( sceneIdx < 0 )
sceneIdx += total;
Layer* pLayer = createZwoptexLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createZwoptexLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
Layer* restartZwoptexTest()
{
Layer* pLayer = createZwoptexLayer(sceneIdx);
pLayer->autorelease();
Layer* layer = createZwoptexLayer(sceneIdx);
layer->autorelease();
return pLayer;
return layer;
}
//------------------------------------------------------------------
@ -210,8 +210,8 @@ std::string ZwoptexGenericTest::subtitle()
void ZwoptexTestScene::runThisTest()
{
Layer* pLayer = nextZwoptexTest();
addChild(pLayer);
Layer* layer = nextZwoptexTest();
addChild(layer);
Director::getInstance()->replaceScene(this);
}

View File

@ -139,12 +139,12 @@ void TestController::menuCallback(Object * pSender)
int idx = pMenuItem->getZOrder() - 10000;
// create the test scene and run it
TestScene* pScene = g_aTestNames[idx].callback();
TestScene* scene = g_aTestNames[idx].callback();
if (pScene)
if (scene)
{
pScene->runThisTest();
pScene->release();
scene->runThisTest();
scene->release();
}
}

View File

@ -35,15 +35,15 @@ void TestScene::onEnter()
outside the scope. So I choose the (2) solution. Commented by James Chen.
*/
// Scene *pScene = Scene::create();
Scene *pScene = new Scene();
if (pScene && pScene->init())
// Scene *scene = Scene::create();
Scene *scene = new Scene();
if (scene && scene->init())
{
Layer* pLayer = new TestController();
pScene->addChild(pLayer);
pLayer->release();
Director::getInstance()->replaceScene(pScene);
pScene->release();
Layer* layer = new TestController();
scene->addChild(layer);
layer->release();
Director::getInstance()->replaceScene(scene);
scene->release();
}
});