#include <gauge3d/input/inputmap.h>
Inherits GAUGE3D::GMessageQueue::Handler.
Public Methods | |
GInputMap (pGMessageQueue outputQueue) | |
Constructs an input map. More... | |
virtual | ~GInputMap () |
Destructor. | |
virtual bool | HandleMessage (pGMessage message) |
Translates and dispatches a message (called by the input message queue). | |
void | NewControl (GString name,int type) |
Add a new control to the list of game-specific controls. More... | |
void | MapInput (GString input,GString control,float sensitivity=1.0) |
Maps an input source to a control with a given sensitivity. More... | |
void | ControlList (pGDirectory config) |
Loads a list of controls from a config file. More... | |
void | ControlMap (pGDirectory config) |
Loads the input to control map from a config file. More... | |
void | ClearControlList () |
Empties the list of controls. | |
void | ClearControlMap () |
Erases all input-to-control mappings. | |
virtual void | DoFrame (tTime time,tTime frameTime) |
This will be called every frame by the scheduler. More... |
GInputMap makes it easy to allow users to configure their controls rather than use forced key bindings. It also translates the input type to the control type (analog vs. digital, absolute vs. relative) and applies sensitivity settings to the controls.
To make the input map translate messages, you must register it as a message handler in the input message queue. Also, make sure to call GInputMap::DoFrame() every frame.
|
Constructs an input map.
|
|
Add a new control to the list of game-specific controls.
When an input source is mapped to a control, the message is translated from the input's type to the control's type, so you don't have to worry about handling any type of input other than what you expect, yet the user is free to bind any sort of input to any control (almost). Choosing the right type for the control is tricky, especially if it is an analog control. Here are what the four types represent:
|
|
Maps an input source to a control with a given sensitivity.
|
|
Loads a list of controls from a config file.
config is one section of the config file. Each line in that section should have the form "control name = [absolute|relative] [digital|analog]". Here's an example:
[controls] |
|
Loads the input to control map from a config file.
config is one section of the config file. Each line in that section should have the form: Here's an example:
[control map] |
|
This will be called every frame by the scheduler.
Reimplemented from GAUGE3D::GObject. |