zoukankan      html  css  js  c++  java
  • 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)

  • 相关阅读:
    php apc缓存以及与redis的对比
    React Refs
    React 表单与事件
    React AJAX
    React 组件生命周期
    React 组件 API
    React Props
    React State(状态)
    react 组件之间传值
    react 创建组件
  • 原文地址:https://www.cnblogs.com/zhangligopher/p/4037577.html
Copyright © 2011-2022 走看看