Gamepad Class Reference
Gamepad class.
More...
#include <Gamepad.h>
List of all members.
Public Types |
enum | e_type { AXIS,
BUTTON
} |
| Type of input available on the game pad.
More...
|
Public Member Functions |
ButtonPtr | axes (uint i) |
ButtonPtr | buttons (uint i) |
int | dispatch (bool debug=false) |
| This function checks the gamepad status and calls the respective callback.
|
| Gamepad () |
| Class constructor.
|
void | plerr (int ret) |
| Print local error function.
|
int | startComm (const char *device) |
| Initialize comm with the gamepad.
|
| ~Gamepad () |
| Class destructor.
|
Private Attributes |
std::vector< ButtonPtr > | axes_ |
| Vector of axes, buttons and axes share the same data structure Button .
|
std::vector< ButtonPtr > | buttons_ |
| Vector of buttons.
|
char | err [1024] |
| Error message.
|
int | fd |
| File descriptor of the device.
|
__u8 | m_axes [ABS_CNT] |
| Mapping variable.
|
__u16 | m_buttons [KEY_MAX-BTN_MISC+1] |
| Mapping variable.
|
int | n_axes |
| Number of axes in the game pad.
|
int | n_buttons |
| Number of buttons in the game pad.
|
char | name [1024] |
| Name of the game pad.
|
int | ret |
| Auxiliary error variable.
|
char | text [1024] |
| Auxiliary string variable.
|
Detailed Description
Gamepad class.
Definition at line 117 of file Gamepad.h.
Member Enumeration Documentation
Type of input available on the game pad.
- Enumerator:
-
Definition at line 121 of file Gamepad.h.
Constructor & Destructor Documentation
Gamepad::Gamepad |
( |
|
) |
[inline] |
Class constructor.
Definition at line 126 of file Gamepad.h.
Gamepad::~Gamepad |
( |
|
) |
[inline] |
Member Function Documentation
ButtonPtr Gamepad::buttons |
( |
uint |
i |
) |
[inline] |
int Gamepad::dispatch |
( |
bool |
debug = false |
) |
[inline] |
This function checks the gamepad status and calls the respective callback.
- Parameters:
-
| debug | if set to true this function will print all events |
- Returns:
- error code that can be analyzed with the function plerr
Definition at line 198 of file Gamepad.h.
void Gamepad::plerr |
( |
int |
ret |
) |
[inline] |
Print local error function.
This function prints the error present in the err variable (this is a private variable of the class_gamepad
). The ret number specifies what kind of error is this, -1 is a error that raises a SIGINT signal, -2 is an warning that allows the program to continue and -3 is a error that prints perror and raises SIGINT.
- Parameters:
-
- Returns:
- void
Definition at line 241 of file Gamepad.h.
int Gamepad::startComm |
( |
const char * |
device |
) |
[inline] |
Initialize comm with the gamepad.
- Parameters:
-
| device | Name of the device to use |
- Returns:
- error code that can be analyzed with the function plerr
Definition at line 149 of file Gamepad.h.
Member Data Documentation
Vector of axes, buttons and axes share the same data structure Button
.
Definition at line 289 of file Gamepad.h.
Vector of buttons.
Definition at line 287 of file Gamepad.h.
File descriptor of the device.
Definition at line 295 of file Gamepad.h.
Number of axes in the game pad.
Definition at line 301 of file Gamepad.h.
Number of buttons in the game pad.
Definition at line 298 of file Gamepad.h.
Name of the game pad.
Definition at line 309 of file Gamepad.h.
Auxiliary error variable.
Definition at line 292 of file Gamepad.h.
Auxiliary string variable.
Definition at line 315 of file Gamepad.h.
The documentation for this class was generated from the following file:
- /home/laradmin/lar/bases/atlascar_base/include/Gamepad.h