Saturday, May 9, 2015

Cocos2dx: Difference between schedule and scheduleUpdate

This is the generic schedule:

//In GameScene.cpp
this->schedule(schedule_selector(GameScene::Update));

void GameScene::Update(float dt){

}

//In GameScene.h
class GameScene : public cocos2d::Layer
{
public:
    static cocos2d::Scene* createScene();
    virtual bool init();
    CREATE_FUNC(GameScene);
    
private:
    void Update(float dt);

};



This is scheduleUpdate:

//In GameScene.cpp
this->scheduleUpdate();

void GameScene::update(float dt){

}


//In GameScene.h
class GameScene : public cocos2d::Layer
{
public:
    static cocos2d::Scene* createScene();
    virtual bool init();
    CREATE_FUNC(GameScene);
    
private:
    void update(float dt);

};


ScheduleUpdate requires lowercase update.


No comments:

Post a Comment