quick cocos 的scheduler 定时器
cocos2dx原生lua对于定时器的写法:
1.每帧调用:
void scheduleUpdateWithPriority(int priority)
void scheduleUpdateWithPriorityLua (int nHandler,int priority)
2.指定调用间隔时间的:
unsigned int scheduleScriptFunc (unsigned int nHandler, float fInterval, bool bPaused)
3.取消定时器事件
void unscheduleScriptEntry (unsigned int uScheduleScriptEntryID)
quick对于schedule的调用:
首先引入这个模块,
local scheduler=require("framework.scheduler")
1.每帧调用:
scheduler.scheduleUpdateGlobal(onInterval)
2.指定调用间隔时间的:
scheduler.scheduleGlobal(onInterval, time)
scheduler.performWithDelayGlobal(onInterval, time)
3.取消定时器事件
scheduler.unscheduleGlobal(handler)
cocos2dx c++ schedule:
scheduleUpdate() ->update(float dt)
schedule(schedule_selector(handler),time)