XNA Input limitations:
XNA has a rather severe limitation with regards to handling keyboard input. It is unable detect any keystrokes that occur between pollings. Because of this if your game is updating at the default 60 fps there are 0.017 seconds between polls can be to slow for individual characters of memorized sequences such as "ing".
To solve this leidegren.se created a hook that is very easy to incorporate into your project. This post is to help you get set up and serve as a reference should you need it. Feel free to post any quirks you run into and I'll add them.
Here is how to set it up:
To initialize the hook.
After initializing the hook there are 9 events that it will trigger. The names are very self explanatory so I'm only gong to talk about a few of the quirks I have come across.
CharEntered returns everything that is a character including returns, backspace characters, and the like. Also keyborad combinations such as Ctrl + C are represented as a single character which can be compared by casing the integer value of the character (for example Ctrl + x == (char)3). CharEntered repeats if the corresponding key is healed down, a behavior very useful for text boxes and the like.
Different types of delegates
No comments:
Post a Comment