I just started using XNA Framework 4.0 today, and I was wondering what the easiest way was to get input from the keyboard. I recognize a lot of C++ in C# but the whole Java side of it is alien to me. This coupled with XNA is a little confusing so, please be specific and give examples. Thanks.
相关问题
- React Native Inline style for multiple Text in sin
- Is it possible to restore a GraphicsDevice if some
- Jasper: error opening input stream from url
- How to implement only emoji keyboard for Entry?
- is it normal for image inputs to be omitted from t
相关文章
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- How do you detect key up / key down events from a
- Show a different value from an input that what wil
- Is there a way to hide the new HTML5 spinbox contr
- Programmatically interrupting raw_input
- Bootstrap input field inside tooltip popover remov
- ValueError: too many values to unpack (expected 2)
- How to show the keyboard for a UIView
If you're comfortable mucking around with the Object Browser in VS, I'd advise looking at Microsoft.Xna.Framework.Input.Keyboard/Keyboardstate. These entries will show you what you have available to you in terms of ready-made functions. Alternatively, you could look on MSDN or follow a tutorial on Creator's Club. I'll post a quick snippet that checks for a specific keystroke.
theKey is a parameter that is defined outside of the scope of this snippet. You could set theKey to a specific value that you would want to trigger some specific program behavior on pressing (at the commented location in the fragment above). theKey is defined as:
previousState and currentState are defined as:
While perhaps not the prettiest way of doing that, it works and is a fairly straightforward example to build from. Hope that helps.