In Cocos2d i use to get my current running scene through the code:
CCScene *runningScene = [[CCDirector sharedDirector] runningScene];
if ([runningScene isKindOfClass:[GameScene class]])
Is there any similar method to get this on cocos2d-x also???
I am using:
CCScene *scene = (CCScene *)CCDirector::sharedDirector()->getRunningScene();
but how to compare it with current scene??
You can use dynamic cast
which returns pointer of given type or returns NULL value.
CCScene *scene = CCDirector::sharedDirector()->getRunningScene();
GameScene* gameScene = dynamic_cast<GameScene*>(scene);
if(gameScene != NULL)
{
// scene is type of GameScene
}