ASGE  3.2.0
Simple Game Framework in GL
ASGE::GamePadData Struct Reference

#include <Gamepad.hpp>

Public Member Functions

 GamePadData (int id, const char *gamepad_name, const float axis_data[6], const unsigned char button_state[15]) noexcept
 
 GamePadData (GamePadData &&rhs)=default
 
 GamePadData (const GamePadData &rhs)=default
 
GamePadDataoperator= (GamePadData &&rhs)=default
 
GamePadDataoperator= (const GamePadData &rhs)=default
 

Public Attributes

float axis [6] { 0.0F }
 
unsigned char buttons [15] { 0 }
 
const char * name { nullptr }
 
int idx { 0 }
 
bool is_connected { false }
 

Detailed Description

Data for connected gamepad.

Data that represents the current state of a connected game pad. Includes the number of axis and buttons along with their current state. If a gamepad is not connected then the status of is_connected will be false.

Warning
Do not work with non connected devices as it will lead to undefined behaviour.
Note
Currently, gamepad support is via polling and not events.

Usage:

auto gamepad = inputs->getGamePad();
if (gamepad.is_connected)
{
}

Definition at line 48 of file Gamepad.hpp.

Constructor & Destructor Documentation

◆ GamePadData()

ASGE::GamePadData::GamePadData ( int  id,
const char *  gamepad_name,
const float  axis_data[6],
const unsigned char  button_state[15] 
)
inlinenoexcept

Default constructor.

Parameters
idThe index of the controller.
gamepad_nameThe name of the controller.
axis_dataThe value of each axis.
button_stateThe state of each button.

Definition at line 57 of file Gamepad.hpp.

Member Data Documentation

◆ axis

float ASGE::GamePadData::axis[6] { 0.0F }

State of axis. The value of each axis

Definition at line 75 of file Gamepad.hpp.

◆ buttons

unsigned char ASGE::GamePadData::buttons[15] { 0 }

State of buttons. The value of each button

Definition at line 76 of file Gamepad.hpp.

◆ idx

int ASGE::GamePadData::idx { 0 }

Index. The index for this controller

Definition at line 78 of file Gamepad.hpp.

◆ is_connected

bool ASGE::GamePadData::is_connected { false }

Is controller connected?

Definition at line 79 of file Gamepad.hpp.

◆ name

const char* ASGE::GamePadData::name { nullptr }

Name. The name of the connected controller

Definition at line 77 of file Gamepad.hpp.


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