raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
raylib::Gamepad Class Reference

Public Member Functions

 Gamepad (int gamepadNumber=0)
 
int GetAxisCount () const
 Return gamepad axis count for a gamepad. More...
 
float GetAxisMovement (int axis) const
 Return axis movement value for a gamepad axis. More...
 
int GetButtonPressed () const
 Get the last gamepad button pressed. More...
 
std::string GetName () const
 Return gamepad internal name id. More...
 
int GetNumber () const
 
bool IsAvailable () const
 Detect if a gamepad is available. More...
 
bool IsButtonDown (int button) const
 Detect if a gamepad button is being pressed. More...
 
bool IsButtonPressed (int button) const
 Detect if a gamepad button has been pressed once. More...
 
bool IsButtonReleased (int button) const
 Detect if a gamepad button has been released once. More...
 
bool IsButtonUp (int button) const
 Detect if a gamepad button is NOT being pressed. More...
 
bool IsName (const std::string &name) const
 Check gamepad name (if available) More...
 
 operator int () const
 
 operator std::string () const
 Return gamepad internal name id. More...
 
Gamepad & operator= (const Gamepad &gamepad)
 
Gamepad & operator= (int gamepadNumber)
 
void SetNumber (int value)
 

Static Public Member Functions

static bool IsAvailable (int number)
 Detect if a gamepad is available. More...
 

Public Attributes

int number
 

Protected Member Functions

void set (int gamepadNumber)
 

Detailed Description

Definition at line 34 of file Gamepad.hpp.

Constructor & Destructor Documentation

◆ Gamepad()

raylib::Gamepad::Gamepad ( int  gamepadNumber = 0)
inline

Definition at line 36 of file Gamepad.hpp.

References set().

Member Function Documentation

◆ GetAxisCount()

int raylib::Gamepad::GetAxisCount ( ) const
inline

Return gamepad axis count for a gamepad.

Definition at line 128 of file Gamepad.hpp.

References number.

◆ GetAxisMovement()

float raylib::Gamepad::GetAxisMovement ( int  axis) const
inline

Return axis movement value for a gamepad axis.

Definition at line 135 of file Gamepad.hpp.

References number.

◆ GetButtonPressed()

int raylib::Gamepad::GetButtonPressed ( ) const
inline

Get the last gamepad button pressed.

Definition at line 121 of file Gamepad.hpp.

◆ GetName()

std::string raylib::Gamepad::GetName ( ) const
inline

Return gamepad internal name id.

Definition at line 79 of file Gamepad.hpp.

References number.

Referenced by operator std::string().

◆ GetNumber()

int raylib::Gamepad::GetNumber ( ) const
inline

Definition at line 41 of file Gamepad.hpp.

◆ IsAvailable() [1/2]

bool raylib::Gamepad::IsAvailable ( ) const
inline

Detect if a gamepad is available.

Definition at line 58 of file Gamepad.hpp.

References number.

◆ IsAvailable() [2/2]

static bool raylib::Gamepad::IsAvailable ( int  number)
inlinestatic

Detect if a gamepad is available.

Definition at line 65 of file Gamepad.hpp.

References number.

◆ IsButtonDown()

bool raylib::Gamepad::IsButtonDown ( int  button) const
inline

Detect if a gamepad button is being pressed.

Definition at line 100 of file Gamepad.hpp.

References number.

◆ IsButtonPressed()

bool raylib::Gamepad::IsButtonPressed ( int  button) const
inline

Detect if a gamepad button has been pressed once.

Definition at line 93 of file Gamepad.hpp.

References number.

◆ IsButtonReleased()

bool raylib::Gamepad::IsButtonReleased ( int  button) const
inline

Detect if a gamepad button has been released once.

Definition at line 107 of file Gamepad.hpp.

References number.

◆ IsButtonUp()

bool raylib::Gamepad::IsButtonUp ( int  button) const
inline

Detect if a gamepad button is NOT being pressed.

Definition at line 114 of file Gamepad.hpp.

References number.

◆ IsName()

bool raylib::Gamepad::IsName ( const std::string &  name) const
inline

Check gamepad name (if available)

Definition at line 72 of file Gamepad.hpp.

References number.

◆ operator int()

raylib::Gamepad::operator int ( ) const
inline

Definition at line 53 of file Gamepad.hpp.

References number.

◆ operator std::string()

raylib::Gamepad::operator std::string ( ) const
inline

Return gamepad internal name id.

Definition at line 86 of file Gamepad.hpp.

References GetName().

◆ operator=() [1/2]

Gamepad& raylib::Gamepad::operator= ( const Gamepad &  gamepad)
inline

Definition at line 43 of file Gamepad.hpp.

References set().

◆ operator=() [2/2]

Gamepad& raylib::Gamepad::operator= ( int  gamepadNumber)
inline

Definition at line 48 of file Gamepad.hpp.

References set().

◆ set()

void raylib::Gamepad::set ( int  gamepadNumber)
inlineprotected

Definition at line 140 of file Gamepad.hpp.

References number.

Referenced by Gamepad(), and operator=().

◆ SetNumber()

void raylib::Gamepad::SetNumber ( int  value)
inline

Definition at line 41 of file Gamepad.hpp.

Member Data Documentation

◆ number

int raylib::Gamepad::number