如何等到 CCMenuItemImage 在目标 C 中按下? [英] How to wait until the CCMenuItemImage is press in objective C?

查看:23
本文介绍了如何等到 CCMenuItemImage 在目标 C 中按下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想暂停程序直到我的按钮被按下

I want to pause the program until my button is press

我通过 Use [[CCDirector sharedDirector] pause] 暂停了我的场景;确保屏幕暂停,但我的功能继续运行,直到它结束功能

I have pause my scene by Use [[CCDirector sharedDirector] pause]; sure that the screen is pause but my function is continue running until it end function

他们有没有等待按钮动作的功能??

Do they have any function to wait for the press button action??

推荐答案

如果你暂停 CCDirector,它会降低帧率到 4 fps - 它不会停止 CCDirector 运行游戏更新,也不会停止执行当前的方法.

If you pause the CCDirector, it will drop the framerate to 4 fps - it does not stop the CCDirector from running game updates, nor will it halt the execution of the current method.

请注意,低帧率会影响触摸检测,您可能会发现在 CCDirector 暂停时很难激活任何 CCMenu 按钮.

Note that the low framerate will affect touch detection and you may find it hard to activate any CCMenu button while CCDirector is paused.

这只是 CCDirector 的暂停方法无法替代真正暂停游戏的两个原因.原则上,当您打开游戏(暂停)菜单时,应该发生的情况是任何游戏对象都没有运行任何更新并暂停任何当前正在运行的操作.只有前台菜单保持正常运行以接收用户输入.

These are just two reasons why CCDirector's pause method is a poor substitute for a real implementation of pausing your game. In principle, when you bring up the ingame (pause) menu, what should happen is that any game play object is simply not running any updates and pauses any currently running actions. Only the foreground menu remains running normally to receive user input.

这篇关于如何等到 CCMenuItemImage 在目标 C 中按下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆