I haven't tested it at all. I'm hoping you guys will do that for me.
Platform: Windows
Hardware Support: Keyboard, Mouse, Xbox 360 Gamepad
File Size: 28.5 KB compressed (39.5 KB for the entire compressed project folder)
I've attached the compressed project folder. You guys are free to use the .dll and source however you wish, as long as you credit DMK741 or "Zer0-One".
How to Use:
#1. Insert Using statement.
Using InputHandler.dll#2. Create your own class for handling input for a specific part of your game.
public class GameplayInputHandler
{
}#3. Inherit from a class in InputHandler depending on which piece of hardware you're updating for.public class GameplayInputHandler : KeyboardInputHandler public class GameplayInputHandler : MouseInputHandler public class GameplayInputHandler : GamepadInputHandler#4. Override the methods for the expected actions.
public override void ActionSpaceBar()
{
//insert implementation here
}#5. Simply update GameplayInputHandlerGameplayInputHandler.update();The properties for each class are as listed below:
KeyboardInputHandler:
CurrentKeys //Returns an array of currently pressed keys.
ContinuousPress // If true, then an action is repeated for as long as the user holds down a key.
// If false, then an action is done once per key-press, no matter how long the key is held down.
MouseInputHandler:
ContinuousPress // If true, then an action is repeated for as long as the user holds down a key.
// If false, then an action is done once per key-press, no matter how long the key is held down.
MouseX // Returns the current X value of the mouse position.
MouseY // Returns the current Y value of the mouse position.
GamepadInputHandler:
Left // Returns a vector representing the current position of the left thumbstick.
Right // Returns a vector representing the current position of the right thumbstick.
ContinuousPress // If true, then an action is repeated for as long as the user holds down a button.
// If false, then an action is done once per button-press, no matter how long the button is held down.
I realize that you can only update for one piece of hardware per class, and I'll fix this later (I hate C#'s lack of multiple inheritance, which is such a powerful thing), but for now, I'd just like to know what you guys think.


Sign In
Create Account



Back to top









