InputListener

Listener for keyboard, joystick, etc. events.

Members

Functions

axisEvent
void axisEvent(uint id, BindingCode code, uint timestamp, float value)

Called when an axis is being operated. The id should be generated from a string, usually the name of the binding. code is a duplicate of the code used for fast lookup of the binding, which also contains other info (deviceID, etc). timestamp is the time lapsed since the start of the program, can be used to measure time between keypresses. value is the current position of the axis normalized between -1.0 and +1.0 for joysticks, and 0.0 and +1.0 for analog triggers.

keyEvent
void keyEvent(uint id, BindingCode code, uint timestamp, bool isPressed)

Called when a keybinding event is generated. The id should be generated from a string, usually the name of the binding. code is a duplicate of the code used for fast lookup of the binding, which also contains other info (deviceID, etc). timestamp is the time lapsed since the start of the program, can be used to measure time between keypresses. NOTE: Hat events on joysticks don't generate keyReleased events, instead they generate keyPressed events on getting centered.

Meta