gKit2 light
Loading...
Searching...
No Matches
Gamepad Struct Reference

Public Member Functions

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

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.

Constructor & Destructor Documentation

◆ Gamepad() [1/2]

Gamepad::Gamepad ( )
inline

Definition at line 10 of file gamepads.h.

10: m_pad(NULL) {}

◆ Gamepad() [2/2]

Gamepad::Gamepad ( SDL_GameController * pad)
inline

Definition at line 11 of file gamepads.h.

11: m_pad(pad) {}

◆ ~Gamepad()

Gamepad::~Gamepad ( )
inline

Definition at line 13 of file gamepads.h.

13{}

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}

Member Data Documentation

◆ m_buttons

int Gamepad::m_buttons[SDL_CONTROLLER_BUTTON_MAX]

Definition at line 28 of file gamepads.h.

◆ m_axis

float Gamepad::m_axis[SDL_CONTROLLER_AXIS_MAX]

Definition at line 29 of file gamepads.h.

◆ m_pad

SDL_GameController* Gamepad::m_pad

Definition at line 31 of file gamepads.h.


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