InputManager

InputManager is a public static class in the SMLimitless Namespace. It provides global access to the current keyboard and mouse states, and provides useful methods for detecting old, current, and new key presses and clicks. It is mostly based on a class made by RCIX of Stack Overflow that he posted as an answer to a question concerning reliable input detection in XNA.

LastKeyboardState
Gets the keyboard state of the last frame.

CurrentKeyboardState
Gets the keyboard state of the current frame.

LastMouseState
Gets the mouse state of the last frame.

CurrentMouseState
Gets the mouse state of the current frame.

MousePosition
Gets the current mouse position.

MouseVelocity
Gets the velocity of the mouse, expressed as the difference between the current and last mouse positions.

MouseWheelPosition
Gets the current position of the mouse wheel.

MouseWheelVelocity
Gets the velocity of the scroll wheel, expressed as the difference between the current and last mouse wheel position.

Update
Updates the InputManager; the current states become the last states, and the new current states are retrieved from XNA's Keyboard and Mouse classes.

IsNewKeyPress
Determines if a certain key is pressed by checking that the key is up in the last state and down in the current state.

IsCurrentKeyPress
Determines if a certain key is pressed by checking that they key is down in both the last and current states.

IsOldKeyPress
Determines if a certain key is pressed by checking that the key is down in the last state and up in the current state.

IsNewMousePress
Determines if a certain mouse button is pressed by checking that the key is up in the last state and down in the current state.

IsCurrentMousePress
Determines if a certain mouse button is pressed by checking that they key is down in both the last and current states.

IsOldMousePress
Determines if a certain mouse button is pressed by checking that the key is down in the last state and up in the current state.