Convenience class for abstracting functionality that already exists in SDL.
More...
#include <GameController.hpp>
|
| GameController () |
| Default constructor - INACCESSIBLE! More...
|
|
void | close () |
| Calls SDL close routine, cleaning up for the controller without intervention. This function is called in the destructor. Do not call this directly, rely on controller going out of scope or, if using dynamic memory, delete as normal. More...
|
|
Convenience class for abstracting functionality that already exists in SDL.
◆ GameController() [1/2]
pk::GameController::GameController |
( |
| ) |
|
|
inlineprivate |
Default constructor - INACCESSIBLE!
◆ GameController() [2/2]
pk::GameController::GameController |
( |
int |
id | ) |
|
Preferred constructor initializing a controller by id, making multiplayer support a bit more sane.
- Parameters
-
◆ ~GameController()
virtual pk::GameController::~GameController |
( |
| ) |
|
|
virtual |
◆ close()
void pk::GameController::close |
( |
| ) |
|
|
private |
Calls SDL close routine, cleaning up for the controller without intervention. This function is called in the destructor. Do not call this directly, rely on controller going out of scope or, if using dynamic memory, delete as normal.
◆ getAxisState()
Sint16 pk::GameController::getAxisState |
( |
int |
axis | ) |
|
|
inline |
Get the axis state for the game pad.
- Parameters
-
int | axis - the axis (see GameControllerAxis enum) you wish to query for the current value. |
- Returns
- Sint16 - an SDL Sint16 corresponding to the controller's axis value. See GameControllerAxis enum for valid states to pass in. See SDL documentation for output ranges.
◆ getButtonState()
Uint8 pk::GameController::getButtonState |
( |
int |
button | ) |
|
|
inline |
Get the button state for the game pad.
- Parameters
-
int | button - the button (see GameControllerButton enum) you wish to query for the current value. |
- Returns
- Uint8 - an SDL Uint8 corresponding to the controller's axis value. See GameControllerButton enum for valid states to pass in. Returns 1 for pressed state or 0 for not pressed (or error) state.
◆ getControllerName()
const char * pk::GameController::getControllerName |
( |
| ) |
|
|
inline |
Get the name for the game pad.
- Returns
- const char* - a C-style string corresponding to the controller name.
◆ getDeadZone()
int pk::GameController::getDeadZone |
( |
| ) |
|
|
inline |
Get the dead zone for the game pad.
- Returns
- int - an int corresponding to the controller's dead zone.
◆ getID()
int pk::GameController::getID |
( |
| ) |
|
|
inline |
Get the id for the game pad.
- Returns
- int - a plain old int corresponding to the controller id.
◆ isConnected()
SDL_bool pk::GameController::isConnected |
( |
| ) |
|
|
inline |
Get the connection status for the game pad.
- Returns
- SDL_bool - an SDL boolean corresponding to the controller's connection status.
◆ setDeadZone()
void pk::GameController::setDeadZone |
( |
int |
deadzone | ) |
|
|
inline |
Get the dead zone for the game pad's joystick(s).
- Parameters
-
int | deadzone - a plain old int that you wish to assign as the controller's dead zone. |
◆ m_controller
SDL_GameController* pk::GameController::m_controller |
|
private |
A handle to the SDL_GameController.
◆ m_deadzone
int pk::GameController::m_deadzone |
|
private |
The value stored for the game controller's axis dead zone.
◆ m_id
int pk::GameController::m_id |
|
private |
The id corresponding to the game controller.
◆ m_name
const char* pk::GameController::m_name |
|
private |
The name given by SDL to the game controller.
The documentation for this class was generated from the following file: