Class InputManager

Class Documentation

class InputManager

Allows interfacing to game controlling hardware, including mouse, keyboard and XInput controllers. Allows detecting inputs through Event dispatch. Event data for boolean buttons consists of a Vector2 where Vector2.x and Vector2.y carry the old and new values for the input event respectively. Float buttons should be queried directly by invoking InputManager.

Public Functions

void initialize(unsigned int width, unsigned int height)
void setEnabled(bool enabled)
void loadSchemes(const HashMap<String, InputScheme> &inputSchemes)
void addScheme(const String &name, const InputScheme &inputScheme)
void pushScheme(const String &schemeName)
void popScheme()
void flushSchemes()
void mapBool(const Event::Type &action, Device device, DeviceButtonID button)

Bind an event to a button on a device.

void mapFloat(const Event::Type &action, Device device, DeviceButtonID button)

Bind an event to a float on a device.

void unmap(const Event::Type &action)
bool isPressed(const Event::Type &action)
bool hasPressed(const Event::Type &action)
bool wasPressed(const Event::Type &action)
float getFloat(const Event::Type &action)
float getFloatDelta(const Event::Type &action)
Vector2 getMousePosition()
void update()
void setDisplaySize(const Vector2 &newSize)
const gainput::InputMap &getMap() const
gainput::InputDeviceMouse *getMouse()
gainput::InputDeviceKeyboard *getKeyboard()
gainput::InputDevicePad *getPad1()
gainput::InputDevicePad *getPad2()

Public Static Functions

static InputManager *GetSingleton()
static void SetEnabled(bool enabled)
static void MapBool(const Event::Type &action, Device device, DeviceButtonID button)
static void MapFloat(const Event::Type &action, Device device, DeviceButtonID button)
static bool IsPressed(const Event::Type &action)
static bool HasPressed(const Event::Type &action)
static bool WasPressed(const Event::Type &action)
static float GetFloat(const Event::Type &action)
static float GetFloatDelta(const Event::Type &action)
static void Unmap(const Event::Type &action)
static Vector2 GetMousePosition()