Corona 应用程序的组件及其执行顺序是什么?
我想知道 Corona 应用程序循环中首先调用两个处理函数中的哪一个:
displayObject:addEventListener( "touch", handler1 )
Runtime:addEventListener( "enterFrame", handler2 )
我可以测试它,但不能确保它始终如此,并且 Ansca 人员不会更改它。由于我使用“enterframe”事件来触发我的游戏代码循环,因此最好知道我的游戏代码还是我的 UI 代码首先运行。
然后我意识到我根本没有从 Ansca 找到任何描述执行循环的文档。编码员可能感兴趣的幕后还有哪些事情发生,顺序是什么?有人参考一些文档吗?
I was wondering which of the two handler functions were called first in a Corona app loop:
displayObject:addEventListener( "touch", handler1 )
Runtime:addEventListener( "enterFrame", handler2 )
I could test for it, but wouldnt be ensured that it was consistently that way and that the Ansca guys wouldnt change it. Since I use the "enterframe" event to trigger my game code loop, it would be good to know whether my game code or my UI code runs first.
I then realized that I hadnt found any documentation from Ansca that described the execution loop at all. What else is going on behind the scenes that might be of interest to the coder, and in what order? Does anybody have a reference to some documentation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,带有 Enterframe 事件的运行时会在帧的每次更改时自动运行,或者您可以说它每毫秒运行一次。因此,每毫秒调用一次 Handler2。现在,当您触摸屏幕时,您的
handler1 函数
被调用为handler2 function
的调用时间差很小。因此,很难说哪个函数首先被调用。希望您已经理解了。Basically Runtime with enterframe Events run automatically on every change in frames or you can say that it runs every milliseconds.So, Handler2 is called every milliseconds.Now,when you touch the screen your
handler1 function
is called as well ashandler2 function
is called with very little time difference.So, it is very difficult to say which function is being called first.Hope you have understood it.