添加 CADisplayLink 到 Cocos2D
我的应用程序中有 Cocos2D,我使用它作为我的游戏的游戏引擎。此时,我需要让游戏循环以屏幕刷新的速度触发。所以这让我认为我需要使用 CADisplayLink。那么我如何实现 CADisplayLink 以便我的由 Cocos2D 组成的游戏循环将以屏幕刷新的速率被调用?
谢谢!
I have Cocos2D in my app and I use it as the game engine for my game. At this point I need to have a game loop fire at the rate the screen refreshes. So this leads me to think that I need to use CADisplayLink. So how would I implement CADisplayLink so that my game loop which will consist of Cocos2D will be called at the rate of the screen refreshing?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Cocos2D 已经集成了 CADisplayLink 对象。事实上,它将使用 CCDirectorDisplayLink 默认情况下,除非您指定了不同的控制器类型。
检查项目的 AppDelegate 类,特别是 didFinishLaunching... 方法。
Cocos2D has the CADisplayLink object already integrated. In fact, it will be using CCDirectorDisplayLink by default unless you have specified a different director type.
Check your project's AppDelegate class, in particular the didFinishLaunching… method.