gKit2 light
Public Member Functions | Public Attributes | List of all members
Gamepad Struct Reference

Public Member Functions

 Gamepad (SDL_GameController *pad)
 
bool connected ()
 renvoie l'etat d'un gamepad. debranche ou pas. More...
 
int button (const SDL_GameControllerButton b)
 renvoie l'etat d'un bouton. More...
 
void clear_button (const SDL_GameControllerButton b)
 desactive un button. More...
 
float axis (const SDL_GameControllerAxis a)
 renvoie la position d'un axe. More...
 
void clear_axis (const SDL_GameControllerAxis a)
 re-initialise la position d'un axe. More...
 

Public Attributes

int m_buttons [SDL_CONTROLLER_BUTTON_MAX]
 
float m_axis [SDL_CONTROLLER_AXIS_MAX]
 
SDL_GameController * m_pad
 

Detailed Description

Definition at line 8 of file gamepads.h.

Member Function Documentation

◆ connected()

bool Gamepad::connected ( )

renvoie l'etat d'un gamepad. debranche ou pas.

Definition at line 128 of file gamepads.cpp.

129 {
130  return (m_pad != NULL);
131 }

◆ button()

int Gamepad::button ( const SDL_GameControllerButton  b)

renvoie l'etat d'un bouton.

Definition at line 133 of file gamepads.cpp.

134 {
135  assert(b < SDL_CONTROLLER_BUTTON_MAX);
136  return m_buttons[b];
137 }

◆ clear_button()

void Gamepad::clear_button ( const SDL_GameControllerButton  b)

desactive un button.

Definition at line 139 of file gamepads.cpp.

140 {
141  assert(b < SDL_CONTROLLER_BUTTON_MAX);
142  m_buttons[b]= 0;
143 }

◆ axis()

float Gamepad::axis ( const SDL_GameControllerAxis  a)

renvoie la position d'un axe.

Definition at line 145 of file gamepads.cpp.

146 {
147  assert(a < SDL_CONTROLLER_AXIS_MAX);
148  return m_axis[a];
149 }

◆ clear_axis()

void Gamepad::clear_axis ( const SDL_GameControllerAxis  a)

re-initialise la position d'un axe.

Definition at line 151 of file gamepads.cpp.

152 {
153  assert(a < SDL_CONTROLLER_AXIS_MAX);
154  m_axis[a]= 0;
155 }

The documentation for this struct was generated from the following files: