GameInput struct

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 OnMouseUp, 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)) ...

Public static functions

static auto IsMouseButtonDown(MouseButton button) -> bool

Constructors, destructors, conversion operators

GameInput()

Public functions

auto OnKeyUp(int vkCode, KeyModifiers modifiers) -> void
auto OnKeyDown(int vkCode, KeyModifiers modifiers) -> void
auto OnMouseDown(MouseButton mouseButton, float mouseX, float mouseY, MouseState mouseState) -> void
auto OnMouseUp(MouseButton mouseButton, float mouseX, float mouseY, MouseState mouseState) -> void
auto OnMouseMove(float mouseX, float mouseY, MouseState state) -> void
auto OnMouseWheel(int nWheelDelta, float mouseX, float mouseY, MouseState mouseState) -> void
auto IsKeyDown(int vkey) const -> bool
auto IsMouseDown(MouseButton button) const -> bool
auto Reset() -> void

Public variables

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.
Math::Point mousePosition
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.
Math::Point clickPosition
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.