This structure keeps track of all the input in the game, such as keys pressed/released, the mouse position, etc.
The recommended usage is having a member of this type in your camera/game mode. On event-like methods, like
OnKeyDown, etc you just call the corresponding GameInput method. Then, in the
Update method you can access the information like this:
if (mInput.IsKeyDown(VK_Z)) ... if (mInput.IsMouseDown(kMouseButtonRight)) ...
- void OnKeyUp(int vkCode, KeyModifiers modifiers)
- void OnKeyDown(int vkCode, KeyModifiers modifiers)
- void OnMouseDown(MouseButton mouseButton, float mouseX, float mouseY, MouseState mouseState)
- void OnMouseUp(MouseButton mouseButton, float mouseX, float mouseY, MouseState mouseState)
- void OnMouseMove(float mouseX, float mouseY, MouseState state)
- void OnMouseWheel(int nWheelDelta, float mouseX, float mouseY, MouseState mouseState)
- auto IsKeyDown(int vkey) const -> bool
- auto IsMouseDown(MouseButton button) const -> bool
- void Reset()
- eastl::bitset<8*32> keys
- The keys that are pressed.
- KeyModifiers keyModifiers
- The modifiers of the last key that was pressed.
- bool mouseButtons
- The mouse buttons that are pressed.
- The last coordinates of the mouse pointer.
- MouseButton mouseButton
- The last mouse button that was pressed, in the enum MouseButton; kMouseButtonNone if no button is pressed.
- The position of the last mouse click.
- MouseState mouseState
- The mouse state (Ctrl down, Alt down, etc) of the last time a mouse button was pressed; values in the MouseState enum.
- int mouseWheel
- The amount of positions the mouse wheel is.