Heim >Datenbank >MySQL-Tutorial >cocos2dx 定时器 schedule scheduleUpdate scheduleOnce
1. schedule a. 启用: this-schedule(schedule_selector(HelloWorld::Move),1.0f); b. 停用: this-unschedule(schedule_selector(HelloWorld::Move)); c.timeProc: void Move(float dt); void HelloWorld::Move(floatdt) { CCLOG(Tick! Tick!); } 2. sche
1. schedule
a. 启用:this->schedule(schedule_selector(HelloWorld::Move),1.0f);
b. 停用:this->unschedule(schedule_selector(HelloWorld::Move));
c.timeProc:void Move(float dt);
void HelloWorld::Move(floatdt)
{
CCLOG("Tick! Tick!");
}
2. scheduleUpdate
a. 启用:this->scheduleUpdate();
b. 停用:this->unscheduleUpdate();
c.timeProc:void Update(float dt);
voidHelloWorld::Update(float dt) // 函数名必须为Update,规定
{
CCLOG("Tick! Tick!");
}
3. scheduleOnce
a. 启用:this->scheduleOnce(schedule_selector(HelloWorld::Move),1.0f);
b. 停用:响应一次之后自动停止
4.停止所有定时器:this->unscheduleAllSelectors();