如何在 XNA 中用户按住手指时连续执行操作
我有一个当用户按住手指时的操作,但是当用户按住手指时如何连续执行此操作?例如我想要:moveRight += 10;当用户将手指按住屏幕右侧时连续。有谁知道如何在 XNA 中执行此操作?
I have an action for when the user holds down their finger, but how do I continuously do this action as the user holds down his finger? For example I want to: moveRight += 10; continuously while the user holds down their finger on the right part of the screen. Does anyone know how to do this in XNA?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用鼠标输入 API (为了在 WP7 上轻松进行单点触控输入),请特别检查:
或使用 触摸输入 API:
Use either the mouse input API (for easy, single-touch input on WP7), specifically check:
Or use the touch input API on WP7:
当他们松开手指时有动作吗?如果是这样,则使用循环结构(游戏循环)并添加一些输入状态,而不是仅响应事件。
查看 的文档Windows Phone 手势支持。
也许您想要处理的“release”事件是 ManipulationCompleted 事件。不过,我无法判断它是仅限 Silverlight,还是同时支持 Silverlight 和 XNA...
如果失败,也许您可以处理较低级别的事件。
手势是整套运动的抽象。 API 的设计目的是完成所有肮脏的工作,即弄清楚发生了什么,并告诉您它确实发生了,而不是它是如何发生的。如果您想要比这更细粒度的控制,那么您需要更细粒度的 API。
请参阅:http://msdn.microsoft.com/ en-us/library/ff607287(v=VS.95).aspx(可能是 Touch 类 )。
Is there an action for when they release their finger? If so, then use a looping structure (game loop) and add some input state, rather than only responding to events.
Looking at The docs for Gesture Support for Windows Phone.
Maybe your "release" event that you want to handle is the
ManipulationCompleted
event. I can't tell if it is Silverlight-only, or both Silverlight and XNA, though...And if that fails, maybe there are lower level events you can handle.
Gestures are abstractions for entire sets of motion. The API is designed to do all the dirty work of figuring out what happened, and telling you that it did happen, not how it happened. If you want to have finer grain control than that, then you need a finer grained API.
See: http://msdn.microsoft.com/en-us/library/ff607287(v=VS.95).aspx (possibly the Touch class).