Public Types | Public Member Functions | Private Attributes | List of all members
Gamepad Class Reference

Gamepad class. More...

#include <Gamepad.h>

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. More...
 
 Gamepad ()
 Class constructor. More...
 
void plerr (int ret)
 Print local error function. More...
 
int startComm (const char *device)
 Initialize comm with the gamepad. More...
 
 ~Gamepad ()
 Class destructor. More...
 

Private Attributes

std::vector< ButtonPtraxes_
 Vector of axes, buttons and axes share the same data structure Button. More...
 
std::vector< ButtonPtrbuttons_
 Vector of buttons. More...
 
char err [1024]
 Error message. More...
 
int fd
 File descriptor of the device. More...
 
__u8 m_axes [ABS_CNT]
 Mapping variable. More...
 
__u16 m_buttons [KEY_MAX-BTN_MISC+1]
 Mapping variable. More...
 
int n_axes
 Number of axes in the game pad. More...
 
int n_buttons
 Number of buttons in the game pad. More...
 
char name [1024]
 Name of the game pad. More...
 
int ret
 Auxiliary error variable. More...
 
char text [1024]
 Auxiliary string variable. More...
 

Detailed Description

Gamepad class.

Definition at line 117 of file Gamepad.h.

Member Enumeration Documentation

Type of input available on the game pad.

Enumerator
AXIS 
BUTTON 

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

Class destructor.

Definition at line 137 of file Gamepad.h.

Member Function Documentation

ButtonPtr Gamepad::axes ( uint  i)
inline

Definition at line 273 of file Gamepad.h.

ButtonPtr Gamepad::buttons ( uint  i)
inline

Definition at line 262 of file Gamepad.h.

int Gamepad::dispatch ( bool  debug = false)
inline

This function checks the gamepad status and calls the respective callback.

Parameters
debugif 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
reterror code
Returns
void

Definition at line 241 of file Gamepad.h.

int Gamepad::startComm ( const char *  device)
inline

Initialize comm with the gamepad.

Parameters
deviceName 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

std::vector<ButtonPtr> Gamepad::axes_
private

Vector of axes, buttons and axes share the same data structure Button.

Definition at line 289 of file Gamepad.h.

std::vector<ButtonPtr> Gamepad::buttons_
private

Vector of buttons.

Definition at line 287 of file Gamepad.h.

char Gamepad::err[1024]
private

Error message.

Definition at line 312 of file Gamepad.h.

int Gamepad::fd
private

File descriptor of the device.

Definition at line 295 of file Gamepad.h.

__u8 Gamepad::m_axes[ABS_CNT]
private

Mapping variable.

Definition at line 304 of file Gamepad.h.

__u16 Gamepad::m_buttons[KEY_MAX-BTN_MISC+1]
private

Mapping variable.

Definition at line 306 of file Gamepad.h.

int Gamepad::n_axes
private

Number of axes in the game pad.

Definition at line 301 of file Gamepad.h.

int Gamepad::n_buttons
private

Number of buttons in the game pad.

Definition at line 298 of file Gamepad.h.

char Gamepad::name[1024]
private

Name of the game pad.

Definition at line 309 of file Gamepad.h.

int Gamepad::ret
private

Auxiliary error variable.

Definition at line 292 of file Gamepad.h.

char Gamepad::text[1024]
private

Auxiliary string variable.

Definition at line 315 of file Gamepad.h.


The documentation for this class was generated from the following file:


atlascar_base
Author(s): Jorge Almeida, Sérgio Pinho, Miguel Oliveira, Pedro Salvado, Andre Oliveira and Pedro Pinheiro
autogenerated on Mon Mar 2 2015 01:31:23