2014-01-14 06:48:12 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2012 cocos2d-x.org
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2014-01-14 06:48:12 +08:00
|
|
|
|
2022-02-24 18:45:25 +08:00
|
|
|
https://adxeproject.github.io/
|
2014-01-14 06:48:12 +08:00
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2011-05-12 10:52:10 +08:00
|
|
|
#include "TransitionsTest.h"
|
|
|
|
#include "../testResource.h"
|
|
|
|
|
2015-04-09 12:23:47 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
|
2011-05-12 10:52:10 +08:00
|
|
|
#define TRANSITION_DURATION (1.2f)
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class FadeWhiteTransition : public TransitionFade
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2021-12-28 16:06:23 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s) { return TransitionFade::create(t, s, Color3B::WHITE); }
|
2010-08-20 14:35:37 +08:00
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class FlipXLeftOver : public TransitionFlipX
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-07-26 05:49:43 +08:00
|
|
|
return TransitionFlipX::create(t, s, TransitionScene::Orientation::LEFT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class FlipXRightOver : public TransitionFlipX
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-07-26 05:49:43 +08:00
|
|
|
return TransitionFlipX::create(t, s, TransitionScene::Orientation::RIGHT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class FlipYUpOver : public TransitionFlipY
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return TransitionFlipY::create(t, s, TransitionScene::Orientation::UP_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class FlipYDownOver : public TransitionFlipY
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return TransitionFlipY::create(t, s, TransitionScene::Orientation::DOWN_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class FlipAngularLeftOver : public TransitionFlipAngular
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return TransitionFlipAngular::create(t, s, TransitionScene::Orientation::LEFT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class FlipAngularRightOver : public TransitionFlipAngular
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-07-26 05:49:43 +08:00
|
|
|
return TransitionFlipAngular::create(t, s, TransitionScene::Orientation::RIGHT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class ZoomFlipXLeftOver : public TransitionZoomFlipX
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return TransitionZoomFlipX::create(t, s, TransitionScene::Orientation::LEFT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class ZoomFlipXRightOver : public TransitionZoomFlipX
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-07-26 05:49:43 +08:00
|
|
|
return TransitionZoomFlipX::create(t, s, TransitionScene::Orientation::RIGHT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class ZoomFlipYUpOver : public TransitionZoomFlipY
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return TransitionZoomFlipY::create(t, s, TransitionScene::Orientation::UP_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class ZoomFlipYDownOver : public TransitionZoomFlipY
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return TransitionZoomFlipY::create(t, s, TransitionScene::Orientation::DOWN_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class ZoomFlipAngularLeftOver : public TransitionZoomFlipAngular
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
return TransitionZoomFlipAngular::create(t, s, TransitionScene::Orientation::LEFT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class ZoomFlipAngularRightOver : public TransitionZoomFlipAngular
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:17:10 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s)
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2013-07-26 05:49:43 +08:00
|
|
|
return TransitionZoomFlipAngular::create(t, s, TransitionScene::Orientation::RIGHT_OVER);
|
2010-08-20 14:35:37 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class PageTransitionForward : public TransitionPageTurn
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2021-12-28 16:06:23 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s) { return TransitionPageTurn::create(t, s, false); }
|
2010-08-20 14:35:37 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
class PageTransitionBackward : public TransitionPageTurn
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2021-12-28 16:06:23 +08:00
|
|
|
static TransitionScene* create(float t, Scene* s) { return TransitionPageTurn::create(t, s, true); }
|
2011-05-12 10:52:10 +08:00
|
|
|
};
|
|
|
|
|
2014-01-03 06:25:28 +08:00
|
|
|
#define STRINGIFY(x) #x
|
2012-03-26 16:46:23 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
#define TRANS(__className__) \
|
|
|
|
{ \
|
|
|
|
[](float t, Scene* s) { return __className__::create(t, s); }, STRINGIFY(__className__), \
|
2014-01-03 06:25:28 +08:00
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
struct _transitions
|
|
|
|
{
|
2014-01-03 06:25:28 +08:00
|
|
|
std::function<TransitionScene*(float t, Scene* s)> function;
|
2021-12-28 16:06:23 +08:00
|
|
|
const char* name;
|
2014-01-03 16:13:13 +08:00
|
|
|
} transitions[] = {
|
2014-01-03 06:25:28 +08:00
|
|
|
TRANS(TransitionJumpZoom),
|
|
|
|
TRANS(TransitionProgressRadialCCW),
|
|
|
|
TRANS(TransitionProgressRadialCW),
|
|
|
|
TRANS(TransitionProgressHorizontal),
|
|
|
|
TRANS(TransitionProgressVertical),
|
|
|
|
TRANS(TransitionProgressInOut),
|
|
|
|
TRANS(TransitionProgressOutIn),
|
|
|
|
|
|
|
|
TRANS(TransitionCrossFade),
|
|
|
|
|
|
|
|
TRANS(PageTransitionForward),
|
|
|
|
TRANS(PageTransitionBackward),
|
|
|
|
TRANS(TransitionFadeTR),
|
|
|
|
TRANS(TransitionFadeBL),
|
|
|
|
TRANS(TransitionFadeUp),
|
|
|
|
TRANS(TransitionFadeDown),
|
|
|
|
|
|
|
|
TRANS(TransitionTurnOffTiles),
|
|
|
|
|
|
|
|
TRANS(TransitionSplitRows),
|
|
|
|
TRANS(TransitionSplitCols),
|
|
|
|
|
|
|
|
TRANS(TransitionFade),
|
|
|
|
TRANS(FadeWhiteTransition),
|
|
|
|
|
|
|
|
TRANS(FlipXLeftOver),
|
|
|
|
TRANS(FlipXRightOver),
|
|
|
|
TRANS(FlipYUpOver),
|
|
|
|
TRANS(FlipYDownOver),
|
|
|
|
TRANS(FlipAngularLeftOver),
|
|
|
|
TRANS(FlipAngularRightOver),
|
|
|
|
|
|
|
|
TRANS(ZoomFlipXLeftOver),
|
|
|
|
TRANS(ZoomFlipXRightOver),
|
|
|
|
TRANS(ZoomFlipYUpOver),
|
|
|
|
TRANS(ZoomFlipYDownOver),
|
|
|
|
TRANS(ZoomFlipAngularLeftOver),
|
|
|
|
TRANS(ZoomFlipAngularRightOver),
|
|
|
|
|
|
|
|
TRANS(TransitionShrinkGrow),
|
|
|
|
TRANS(TransitionRotoZoom),
|
|
|
|
|
|
|
|
TRANS(TransitionMoveInL),
|
|
|
|
TRANS(TransitionMoveInR),
|
|
|
|
TRANS(TransitionMoveInT),
|
|
|
|
TRANS(TransitionMoveInB),
|
|
|
|
|
|
|
|
TRANS(TransitionSlideInL),
|
|
|
|
TRANS(TransitionSlideInR),
|
|
|
|
TRANS(TransitionSlideInT),
|
|
|
|
TRANS(TransitionSlideInB),
|
2011-05-12 10:52:10 +08:00
|
|
|
};
|
2014-01-03 06:25:28 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
TransitionsTests::TransitionsTests()
|
2010-08-20 14:35:37 +08:00
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
int sceneIndex = 0;
|
2011-07-12 17:35:15 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
for (auto& test : transitions)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
addTestCase(test.name, [sceneIndex]() {
|
2015-04-03 14:31:03 +08:00
|
|
|
auto scene = TransitionsTest::create();
|
|
|
|
// fix bug #486, without setDepthTest(false), FlipX,Y will flickers
|
2019-06-30 11:36:52 +08:00
|
|
|
Director::getInstance()->getRenderer()->setDepthTest(false);
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
if (sceneIndex % 2)
|
|
|
|
{
|
|
|
|
scene->addChild(TestLayer2::create(transitions[sceneIndex].name));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scene->addChild(TestLayer1::create(transitions[sceneIndex].name));
|
|
|
|
}
|
|
|
|
|
|
|
|
return transitions[sceneIndex].function(TRANSITION_DURATION, scene);
|
|
|
|
});
|
|
|
|
|
|
|
|
sceneIndex++;
|
|
|
|
}
|
2014-01-03 06:25:28 +08:00
|
|
|
}
|
2011-05-12 10:52:10 +08:00
|
|
|
|
2021-12-28 15:58:56 +08:00
|
|
|
TestLayer1* TestLayer1::create(std::string_view transitionName)
|
2011-05-12 10:52:10 +08:00
|
|
|
{
|
2021-12-08 00:11:53 +08:00
|
|
|
auto layer = new TestLayer1(transitionName);
|
|
|
|
if (layer->init())
|
2015-04-03 14:31:03 +08:00
|
|
|
{
|
|
|
|
layer->autorelease();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete layer;
|
|
|
|
layer = nullptr;
|
|
|
|
}
|
2011-05-12 10:52:10 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
return layer;
|
2011-05-12 10:52:10 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 15:58:56 +08:00
|
|
|
TestLayer1::TestLayer1(std::string_view transitionName)
|
2011-05-12 10:52:10 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
float x, y;
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
x = size.width;
|
|
|
|
y = size.height;
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto bg1 = Sprite::create(s_back1);
|
2021-12-28 16:06:23 +08:00
|
|
|
bg1->setPosition(Vec2(size.width / 2, size.height / 2));
|
2010-08-20 14:35:37 +08:00
|
|
|
addChild(bg1, -1);
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
auto title = Label::createWithTTF(transitionName, "fonts/Thonburi.ttf", 32);
|
2010-08-20 14:35:37 +08:00
|
|
|
addChild(title);
|
2021-12-28 16:06:23 +08:00
|
|
|
title->setColor(Color3B(255, 32, 32));
|
|
|
|
title->setPosition(Vec2(x / 2, y - 100));
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto label = Label::createWithTTF("SCENE 1", "fonts/Marker Felt.ttf", 38);
|
2021-12-28 16:06:23 +08:00
|
|
|
label->setColor(Color3B(16, 16, 255));
|
|
|
|
label->setPosition(Vec2(x / 2, y / 2));
|
|
|
|
addChild(label);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
schedule(CC_SCHEDULE_SELECTOR(TestLayer1::step), 1.0f);
|
2011-05-12 10:52:10 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
TestLayer1::~TestLayer1() {}
|
2011-05-12 10:52:10 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void TestLayer1::step(float dt) {}
|
2011-05-12 10:52:10 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void TestLayer1::onEnter()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onEnter();
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 1 onEnter");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestLayer1::onEnterTransitionDidFinish()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onEnterTransitionDidFinish();
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 1: onEnterTransitionDidFinish");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestLayer1::onExitTransitionDidStart()
|
2012-03-26 16:46:23 +08:00
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onExitTransitionDidStart();
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 1: onExitTransitionDidStart");
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestLayer1::onExit()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onExit();
|
2019-06-30 11:36:52 +08:00
|
|
|
Director::getInstance()->getRenderer()->setDepthTest(false);
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 1 onExit");
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 15:58:56 +08:00
|
|
|
TestLayer2* TestLayer2::create(std::string_view transitionName)
|
2015-04-03 14:31:03 +08:00
|
|
|
{
|
2021-12-08 00:11:53 +08:00
|
|
|
auto layer = new TestLayer2(transitionName);
|
|
|
|
if (layer->init())
|
2015-04-03 14:31:03 +08:00
|
|
|
{
|
|
|
|
layer->autorelease();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete layer;
|
|
|
|
layer = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return layer;
|
|
|
|
}
|
|
|
|
|
2021-12-28 15:58:56 +08:00
|
|
|
TestLayer2::TestLayer2(std::string_view transitionName)
|
2011-05-12 10:52:10 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
float x, y;
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto size = Director::getInstance()->getWinSize();
|
2021-12-28 16:06:23 +08:00
|
|
|
x = size.width;
|
|
|
|
y = size.height;
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto bg1 = Sprite::create(s_back2);
|
2021-12-28 16:06:23 +08:00
|
|
|
bg1->setPosition(Vec2(size.width / 2, size.height / 2));
|
2010-08-20 14:35:37 +08:00
|
|
|
addChild(bg1, -1);
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
auto title = Label::createWithTTF(transitionName, "fonts/Thonburi.ttf", 32);
|
2010-08-20 14:35:37 +08:00
|
|
|
addChild(title);
|
2021-12-28 16:06:23 +08:00
|
|
|
title->setColor(Color3B(255, 32, 32));
|
|
|
|
title->setPosition(Vec2(x / 2, y - 100));
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto label = Label::createWithTTF("SCENE 2", "fonts/Marker Felt.ttf", 38);
|
2021-12-28 16:06:23 +08:00
|
|
|
label->setColor(Color3B(16, 16, 255));
|
|
|
|
label->setPosition(Vec2(x / 2, y / 2));
|
|
|
|
addChild(label);
|
2010-08-20 14:35:37 +08:00
|
|
|
|
2014-10-04 00:38:36 +08:00
|
|
|
schedule(CC_SCHEDULE_SELECTOR(TestLayer2::step), 1.0f);
|
2011-05-12 10:52:10 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
TestLayer2::~TestLayer2() {}
|
2011-05-12 10:52:10 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void TestLayer2::step(float dt) {}
|
2012-03-26 16:46:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void TestLayer2::onEnter()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onEnter();
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 2 onEnter");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestLayer2::onEnterTransitionDidFinish()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onEnterTransitionDidFinish();
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 2: onEnterTransitionDidFinish");
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestLayer2::onExitTransitionDidStart()
|
2012-03-26 16:46:23 +08:00
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onExitTransitionDidStart();
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 2: onExitTransitionDidStart");
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TestLayer2::onExit()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Layer::onExit();
|
2019-06-30 11:36:52 +08:00
|
|
|
Director::getInstance()->getRenderer()->setDepthTest(false);
|
2013-07-24 06:20:22 +08:00
|
|
|
log("Scene 2 onExit");
|
2012-03-26 16:46:23 +08:00
|
|
|
}
|