The input module takes care of handling user input from keyboard, mouse and gamepads, based on a publish-subscribe architecture.
Mapping of Controls
In addition to directly recieving input from keyboard, mouse and gamepad, there is a virtual control device featuring four directional and four action buttons that can be mapped to any key, axis or button of the three real input devices. This allows configurable controls, although it limits the number of available hot-keys to account for gamepads with only a few buttons.
Note that two events are sent out for mapped controls: at first the actual mouse-, keyboard- or gamepad event, then the virtual control event.
Since input events are in some ways different from in-game events, they do not use the ordinary event system but have an implementation of their own. It works quite similar however: a listener has to be registered at the event manager, providing a callback for each type of input (mouse, keyboard, gamepad or control) the recipient is interested in. When input is made, all listeners registered for a given event type will have the according callback messaged, where they can take action depending on the event's contents.
The callback may return true to consume the event or false to propagate it to the next listener. A listener may request focus from the manager, making it the first instance to recieve any input event. This is useful for the window system to handle multiple windows open at the same time.