cocos2d-x 定时器selector的使用 :schedule的使用
在游戏设计时,我们需要不断的改变屏幕显示来反映游戏操作的效果,最简单的就是提示用户已经进行的游戏时间。为此,我们需要使用cocos2d-x内置的任务调度机制,即CCNode的schedule成员函数。
void | schedule (SEL_SCHEDULE selector) |
schedules a selector. | |
void | schedule (SEL_SCHEDULE selector, ccTime interval) |
schedules a custom selector with an interval time in seconds. | |
void | unschedule (SEL_SCHEDULE selector) |
unschedules a custom selector. | |
void | unscheduleAllSelectors (void) |
unschedule all scheduled selectors: custom selectors, and the 'update' selector. |
cocos2d-x中的schedule有两种作用:
1)定时执行方法 例如,每隔1秒就执行GameLayer类的方法step(ccTime dt)。
2)延时执行方法 例如, 延时 5秒执行GameLayer类的方法step(ccTime dt)。
cocos2d-x 定时器selector的使用 :schedule的使用的更多相关文章
- 6.cocos2d设置定时器
T1LayerAnchorPoint.h #pragma once #include "cocos2d.h" USING_NS_CC; class T1LayerAnchorPoi ...
- cocos2d-x学习知识点记录
环境搭建 http://4137613.blog.51cto.com/4127613/751149 Cocos2d-x初探,HelloWorld解读 http://www.cnblogs.com/Ke ...
- cocos2d JS 利用定时器实现-倒计时功能
//创建一个定时器 cc.director.getScheduler().schedule(this, this.updates, 1, cc.REPEAT_FOREVER, 0, false, &q ...
- Cocos2d-x之定时器
| 版权声明:本文为博主原创文章,未经博主允许不得转载. 每一个游戏程序都有一个循环在不断运行,它是由导演对象来管理与维护.如果需要场景中的精灵运动起来,可以在游戏循环中使用定时器对精灵等对象进行 ...
- Cocos2D研究院之CCNode详解(三)
http://www.xuanyusong.com/archives/950 上一章我们了解了cocos2d的项目路径以及工作原理,这次作者要真刀真枪地讲解代码了,咱们先来看看cocos2d最常用.也 ...
- cocos2dx定时器
cocos2dx三种定时器的使用以及停止schedule,scheduleUpdate,scheduleOnce 首先,什么是定时器呢?或许你有时候会想让某个函数不断的去执行,或许只是执行一次,获取你 ...
- Spring源码情操陶冶-任务定时器ConcurrentTaskScheduler
承接前文Spring源码情操陶冶#task:scheduled-tasks解析器,本文在前文的基础上讲解单核心线程线程池的工作原理 应用附例 承接前文的例子,如下 <!--define bean ...
- Linux时间子系统之七:定时器的应用--msleep(),hrtimer_nanosleep()
我们已经在前面几章介绍了低分辨率定时器和高精度定时器的实现原理,内核为了方便其它子系统,在时间子系统中提供了一些用于延时或调度的API,例如msleep,hrtimer_nanosleep等等,这些A ...
- android开发 系统时间与定时器之间有关系嘛?
如题: android开发 系统时间与定时器之间有关系嘛? 答案:有. 看定时器源码: /* * Schedule a task. */ private void scheduleImpl(Timer ...
随机推荐
- UVALive 2145 Lost in Space(暴力)
题目并不难,就是暴力,需要注意一下输出形式和精度. #include<iostream> #include<cstdio> #include<cmath> usin ...
- PAT1014
Suppose a bank has N windows open for service. 一个银行有N个服务的窗口 There is a yellow line in front of the w ...
- Android Studio ADB响应失败解决方法(2CTo.com)
当启动Android Studio时,如果弹出 adb not responding. you can wait more,or kill "adb.exe" process ma ...
- Git 使用初体验
http://my.oschina.net/moooofly/blog/228608 很久之前在 http://git.oschina.net/ 上创建了一个私有项目 modb ,目的主要是用来学习如 ...
- foo bar的意思
有些朋友问:foo, bar是什么意思, 为什么C++书籍中老见到这个词. 我google了一下, 发现没有很好的中文答案.这个问题,在维基百科上有很好的回答.在这里翻译给大家. 译文: 术语foob ...
- jvisualvm
f the fonts used by VisualVM are hard to read, switching the LaF might help. Try for example 'visu ...
- virtualbox, vt-s, rmmod kvm-intel
http://blog.sina.com.cn/s/blog_4e7b97f00100fltu.html装完后,去下个jdk,坑爹的Oracle非要让老子注册,试了几次都没有成功,密码不合格拉,邮箱已 ...
- public private proteccted区别
public公共,加上这个修饰的类或属性,可以在同一个包或者别的包里面访问 private私有的,加上这个修饰的类或属性,只能在同类里访问,同包和别的包不能访问 protected保护,加上这个修饰的 ...
- FusionCharts生成Flash图表常见问题FAQ
本文主要汇总了FusionCharts生成Flash图表时的一些常见问题(FAQ)以及解决方法/调试方法,欢迎交流! 问题描述:利用FusionCharts创建Flash图表时,能否直接从数组或rec ...
- multipleOutputs Hadoop
package org.lukey.hadoop.muloutput; import java.io.IOException; import org.apache.hadoop.conf.Config ...