#include <nglInputDevice.h>
This class manages input devices like joysticks or tablets. It uses a simple abstraction model :
Analog 4-axis 10-button 1-hat Saitek joystick
Game port #1
Input device instances are created via Enum() (the constructor is not available). Values are read by polling, you have to explicitly call Update() to update the buttons and axis values, then read them via GetButtonState() and GetAxeValue().
Note that the core keyboard and mouse are not handled by thic class, they are implicitly managed by nglWindow due to their interaction with the windowing system.
Public Member Functions | |
Life cycle | |
| virtual | ~nglInputDevice () |
Status polling | |
| bool | Update () |
| nglString | GetPort () |
| nglString | GetName () |
| uint | GetButtonCount () |
| bool | GetButtonState (uint Index) |
| uint | GetAxeCount () |
| float | GetAxeValue (uint Index) |
| void | Dump (uint Level=0) const |
Static Public Member Functions | |
Enumeration | |
| static nglInputDevice * | Enum (uint Index) |
Friends | |
| class | nglInputDeviceInstance |
|
|
|
|
|
Dumps device description info at log level
|
|
|
Enumerate available input devices
nglInputDevice* dev; uint i = 0; while ((dev = nglInputDevice::Enum(i++))) { dev->Dump(); delete dev; } You can have several instances representing the same device (queried with the same index), and you must delete all of them when you don't need them. |
|
|
Number of axis.
|
|
|
Value of the Index-nth axis (-1 to 1).
|
|
|
Number of buttons.
|
|
|
State of the Index-nth button.
|
|
|
Device description.
|
|
|
Physical port description.
|
|
|
Polls for current buttons and axis values
|
|
|
|
1.4.1