mirror of https://github.com/axmolengine/axmol.git
issue #2790: Updates Tests.
This commit is contained in:
parent
16cd61f024
commit
ba56bf6ecd
|
@ -2137,14 +2137,13 @@ string ActionCardinalSpline::subtitle()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PauseResumeActions::PauseResumeActions()
|
PauseResumeActions::PauseResumeActions()
|
||||||
: _pausedTargets(NULL)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PauseResumeActions::~PauseResumeActions()
|
PauseResumeActions::~PauseResumeActions()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_pausedTargets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseResumeActions::onEnter()
|
void PauseResumeActions::onEnter()
|
||||||
|
@ -2176,9 +2175,7 @@ void PauseResumeActions::pause(float dt)
|
||||||
log("Pausing");
|
log("Pausing");
|
||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
|
|
||||||
CC_SAFE_RELEASE(_pausedTargets);
|
|
||||||
_pausedTargets = director->getActionManager()->pauseAllRunningActions();
|
_pausedTargets = director->getActionManager()->pauseAllRunningActions();
|
||||||
CC_SAFE_RETAIN(_pausedTargets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseResumeActions::resume(float dt)
|
void PauseResumeActions::resume(float dt)
|
||||||
|
@ -2186,6 +2183,7 @@ void PauseResumeActions::resume(float dt)
|
||||||
log("Resuming");
|
log("Resuming");
|
||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
director->getActionManager()->resumeTargets(_pausedTargets);
|
director->getActionManager()->resumeTargets(_pausedTargets);
|
||||||
|
_pausedTargets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
|
@ -553,7 +553,7 @@ public:
|
||||||
void pause(float dt);
|
void pause(float dt);
|
||||||
void resume(float dt);
|
void resume(float dt);
|
||||||
private:
|
private:
|
||||||
Set *_pausedTargets;
|
Vector<Node*> _pausedTargets;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -360,14 +360,14 @@ Sprite* PhysicsDemo::makeTriangle(Point point, Size size, PhysicsMaterial materi
|
||||||
bool PhysicsDemo::onTouchBegan(Touch* touch, Event* event)
|
bool PhysicsDemo::onTouchBegan(Touch* touch, Event* event)
|
||||||
{
|
{
|
||||||
auto location = touch->getLocation();
|
auto location = touch->getLocation();
|
||||||
Array* arr = _scene->getPhysicsWorld()->getShapes(location);
|
auto arr = _scene->getPhysicsWorld()->getShapes(location);
|
||||||
|
|
||||||
PhysicsBody* body = nullptr;
|
PhysicsBody* body = nullptr;
|
||||||
for (Object* obj : *arr)
|
for (auto& obj : arr)
|
||||||
{
|
{
|
||||||
if ((dynamic_cast<PhysicsShape*>(obj)->getBody()->getTag() & DRAG_BODYS_TAG) != 0)
|
if ((obj->getBody()->getTag() & DRAG_BODYS_TAG) != 0)
|
||||||
{
|
{
|
||||||
body = dynamic_cast<PhysicsShape*>(obj)->getBody();
|
body = obj->getBody();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1017,9 +1017,8 @@ void PhysicsDemoPump::onEnter()
|
||||||
|
|
||||||
void PhysicsDemoPump::update(float delta)
|
void PhysicsDemoPump::update(float delta)
|
||||||
{
|
{
|
||||||
for (auto obj : *_scene->getPhysicsWorld()->getAllBodies())
|
for (const auto& body : _scene->getPhysicsWorld()->getAllBodies())
|
||||||
{
|
{
|
||||||
PhysicsBody* body = dynamic_cast<PhysicsBody*>(obj);
|
|
||||||
if (body->getTag() == DRAG_BODYS_TAG && body->getPosition().y < 0.0f)
|
if (body->getTag() == DRAG_BODYS_TAG && body->getPosition().y < 0.0f)
|
||||||
{
|
{
|
||||||
body->getNode()->setPosition(VisibleRect::leftTop() + Point(75 + CCRANDOM_0_1() * 90, 0));
|
body->getNode()->setPosition(VisibleRect::leftTop() + Point(75 + CCRANDOM_0_1() * 90, 0));
|
||||||
|
|
|
@ -195,14 +195,13 @@ std::string SchedulerPauseResume::subtitle()
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
SchedulerPauseResumeAll::SchedulerPauseResumeAll()
|
SchedulerPauseResumeAll::SchedulerPauseResumeAll()
|
||||||
: _pausedTargets(NULL)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SchedulerPauseResumeAll::~SchedulerPauseResumeAll()
|
SchedulerPauseResumeAll::~SchedulerPauseResumeAll()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_pausedTargets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerPauseResumeAll::onEnter()
|
void SchedulerPauseResumeAll::onEnter()
|
||||||
|
@ -227,7 +226,7 @@ void SchedulerPauseResumeAll::update(float delta)
|
||||||
|
|
||||||
void SchedulerPauseResumeAll::onExit()
|
void SchedulerPauseResumeAll::onExit()
|
||||||
{
|
{
|
||||||
if(_pausedTargets != NULL)
|
if (!_pausedTargets.empty())
|
||||||
{
|
{
|
||||||
Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets);
|
Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets);
|
||||||
}
|
}
|
||||||
|
@ -249,9 +248,8 @@ void SchedulerPauseResumeAll::pause(float dt)
|
||||||
log("Pausing");
|
log("Pausing");
|
||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
_pausedTargets = director->getScheduler()->pauseAllTargets();
|
_pausedTargets = director->getScheduler()->pauseAllTargets();
|
||||||
CC_SAFE_RETAIN(_pausedTargets);
|
|
||||||
|
|
||||||
unsigned int c = _pausedTargets->count();
|
int c = _pausedTargets.size();
|
||||||
|
|
||||||
if (c > 2)
|
if (c > 2)
|
||||||
{
|
{
|
||||||
|
@ -265,7 +263,7 @@ void SchedulerPauseResumeAll::resume(float dt)
|
||||||
log("Resuming");
|
log("Resuming");
|
||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
director->getScheduler()->resumeTargets(_pausedTargets);
|
director->getScheduler()->resumeTargets(_pausedTargets);
|
||||||
CC_SAFE_RELEASE_NULL(_pausedTargets);
|
_pausedTargets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SchedulerPauseResumeAll::title()
|
std::string SchedulerPauseResumeAll::title()
|
||||||
|
@ -285,14 +283,13 @@ std::string SchedulerPauseResumeAll::subtitle()
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
SchedulerPauseResumeAllUser::SchedulerPauseResumeAllUser()
|
SchedulerPauseResumeAllUser::SchedulerPauseResumeAllUser()
|
||||||
: _pausedTargets(NULL)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SchedulerPauseResumeAllUser::~SchedulerPauseResumeAllUser()
|
SchedulerPauseResumeAllUser::~SchedulerPauseResumeAllUser()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_pausedTargets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerPauseResumeAllUser::onEnter()
|
void SchedulerPauseResumeAllUser::onEnter()
|
||||||
|
@ -314,7 +311,7 @@ void SchedulerPauseResumeAllUser::onEnter()
|
||||||
|
|
||||||
void SchedulerPauseResumeAllUser::onExit()
|
void SchedulerPauseResumeAllUser::onExit()
|
||||||
{
|
{
|
||||||
if(_pausedTargets != NULL)
|
if (!_pausedTargets.empty())
|
||||||
{
|
{
|
||||||
Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets);
|
Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets);
|
||||||
}
|
}
|
||||||
|
@ -336,7 +333,6 @@ void SchedulerPauseResumeAllUser::pause(float dt)
|
||||||
log("Pausing");
|
log("Pausing");
|
||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
_pausedTargets = director->getScheduler()->pauseAllTargetsWithMinPriority(Scheduler::PRIORITY_NON_SYSTEM_MIN);
|
_pausedTargets = director->getScheduler()->pauseAllTargetsWithMinPriority(Scheduler::PRIORITY_NON_SYSTEM_MIN);
|
||||||
CC_SAFE_RETAIN(_pausedTargets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedulerPauseResumeAllUser::resume(float dt)
|
void SchedulerPauseResumeAllUser::resume(float dt)
|
||||||
|
@ -344,7 +340,7 @@ void SchedulerPauseResumeAllUser::resume(float dt)
|
||||||
log("Resuming");
|
log("Resuming");
|
||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
director->getScheduler()->resumeTargets(_pausedTargets);
|
director->getScheduler()->resumeTargets(_pausedTargets);
|
||||||
CC_SAFE_RELEASE_NULL(_pausedTargets);
|
_pausedTargets.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SchedulerPauseResumeAllUser::title()
|
std::string SchedulerPauseResumeAllUser::title()
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
void pause(float dt);
|
void pause(float dt);
|
||||||
void resume(float dt);
|
void resume(float dt);
|
||||||
private:
|
private:
|
||||||
Set* _pausedTargets;
|
Vector<Object*> _pausedTargets;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SchedulerPauseResumeAllUser : public SchedulerTestLayer
|
class SchedulerPauseResumeAllUser : public SchedulerTestLayer
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
void pause(float dt);
|
void pause(float dt);
|
||||||
void resume(float dt);
|
void resume(float dt);
|
||||||
private:
|
private:
|
||||||
Set* _pausedTargets;
|
Vector<Object*> _pausedTargets;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SchedulerUnscheduleAll : public SchedulerTestLayer
|
class SchedulerUnscheduleAll : public SchedulerTestLayer
|
||||||
|
|
Loading…
Reference in New Issue