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< ButtonPtraxes_
 Vector of axes, buttons and axes share the same data structure Button.
std::vector< ButtonPtrbuttons_
 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:
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:
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:
ret error code
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

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


atlascar_base
Author(s): Jorge Almeida, Miguel Oliveira, Pedro Salvado, Andre Oliveira and Pedro Pinheiro
autogenerated on Wed Jul 23 04:34:34 2014