So I made a DLL to help manage input in my games. It raises events when certain actions are performed. I figured I'd put it out there in case anyone else wanted to use it.
You can download the DLL and the source code at the CodePlex page
Quote:
This is the first release of my Zune Input Management Library. That's quite a mouthful, eh? Anyways, this is basically two game components; InputManager and TouchInputManager. They raise events when the user pushes buttons and stuff. I tried to include every reasonable kind of input you would need. For example, for each button on the Zune, the InputManager class has the following:- A bool value that indicates if the button is pressed.
- An event that is raised if the button goes from being released to pressed.
- An event that is raised if the button goes from being pressed to released.
- An event that is raised if the button remains pressed for an amount of time you define.
- An event that is raised if the button is released after being "held" (see above).
- An event that is raised if the button is released without being "held".
Additionally, all of these buttons use their common names, so you won't need to worry about which is A and which is B anymore.
The TouchInputManager is the other game component included. It has the following:- A bool value that indicates if the Zune has a touchpad.
- A bool value that indicates if the touchpad is touched.
- A structure, "TouchpadPosition", that tells where the touchpad is being touched and what section of the touchpad this position is in.
- A bool value that indicates if the touchpad is pressed (or "clicked").
- An event that is raised if the touchpad (anywhere on the touchpad) goes from being released to pressed.
- An event that is raised if the touchpad goes from being pressed to released.
- An event that is raised if the touchpad remains pressed for an amount of time you define.
- An event that is raised if the touchpad is released after being "held" (see above).
- An event that is raised if the touchpad is released without being "held".
- An event that is raised if the touchpad is touched in any location; this event also tells where the touchpad was touched.
- Events that are raised if specific sections of the touchpad are touched.
- An event that is raised if the user removes their finger from the touchpad; this event also tells where the touchpad was touched.
- Events that are raised if the user removes their finger from specific sections of the touchpad.
- An event that is raised if the user "flicks" their finger across the touchpad; this event also tells how long the flick lasted, where it began, and where it ended.
- Events that are raised if the user flicks their finger from a specific section of the touchpad to another specific section.
- An event that is raised if the removes their finger from the touchpad without having performed a flick.
- Events that are raised if the user removes their finger from specific sections of the touchpad without having performed a flick.
|
Here is a sample implementation.
I hope that somebody will find this useful. If you want to use this in one of your games go right ahead. If you want to use it but think it needs something more, just say the word and I'll see what I can do.