SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::Gamepad Class Reference

The structure used to identify an SDL gamepad. More...

Inheritance diagram for SDL::Gamepad:
Inheritance graph
[legend]

Public Member Functions

constexpr Gamepad ()=default
 Default ctor.
 
constexpr Gamepad (const GamepadRaw resource)
 Constructs from GamepadParam. More...
 
constexpr Gamepad (const Gamepad &other)=delete
 Copy constructor.
 
constexpr Gamepad (Gamepad &&other)
 Move constructor.
 
constexpr Gamepad (const GamepadRef &other)=delete
 
constexpr Gamepad (GamepadRef &&other)=delete
 
 Gamepad (JoystickID instance_id)
 Open a gamepad for use. More...
 
 ~Gamepad ()
 Destructor.
 
Gamepadoperator= (Gamepad other)
 Assignment operator.
 
constexpr GamepadRaw get () const
 Retrieves underlying GamepadRaw.
 
constexpr GamepadRaw release ()
 Retrieves underlying GamepadRaw and clear this.
 
constexpr auto operator<=> (const Gamepad &other) const =default
 Comparison.
 
constexpr bool operator== (std::nullptr_t _) const
 Comparison.
 
constexpr operator bool () const
 Converts to bool.
 
constexpr operator GamepadParam () const
 Converts to GamepadParam.
 
void Close ()
 Close a gamepad previously opened with Gamepad.Gamepad(). More...
 
char * GetMapping ()
 Get the current mapping of a gamepad. More...
 
PropertiesRef GetProperties ()
 Get the properties associated with an opened gamepad. More...
 
JoystickID GetID ()
 Get the instance ID of an opened gamepad. More...
 
const char * GetName ()
 Get the implementation-dependent name for an opened gamepad. More...
 
const char * GetPath ()
 Get the implementation-dependent path for an opened gamepad. More...
 
GamepadType GetType ()
 Get the type of an opened gamepad. More...
 
GamepadType GetRealType ()
 Get the type of an opened gamepad, ignoring any mapping override. More...
 
int GetPlayerIndex ()
 Get the player index of an opened gamepad. More...
 
void SetPlayerIndex (int player_index)
 Set the player index of an opened gamepad. More...
 
Uint16 GetVendor ()
 Get the USB vendor ID of an opened gamepad, if available. More...
 
Uint16 GetProduct ()
 Get the USB product ID of an opened gamepad, if available. More...
 
Uint16 GetProductVersion ()
 Get the product version of an opened gamepad, if available. More...
 
Uint16 GetFirmwareVersion ()
 Get the firmware version of an opened gamepad, if available. More...
 
const char * GetSerial ()
 Get the serial number of an opened gamepad, if available. More...
 
Uint64 GetSteamHandle ()
 Get the Steam Input handle of an opened gamepad, if available. More...
 
JoystickConnectionState GetConnectionState ()
 Get the connection state of a gamepad. More...
 
PowerState GetPowerInfo (int *percent)
 Get the battery state of a gamepad. More...
 
bool Connected ()
 Check if a gamepad has been opened and is currently connected. More...
 
JoystickRef GetJoystick ()
 Get the underlying joystick from a gamepad. More...
 
SDL_GamepadBinding ** GetBindings (int *count)
 Get the SDL joystick layer bindings for a gamepad. More...
 
bool HasAxis (GamepadAxis axis)
 Query whether a gamepad has a given axis. More...
 
Sint16 GetAxis (GamepadAxis axis)
 Get the current state of an axis control on a gamepad. More...
 
bool HasButton (GamepadButton button)
 Query whether a gamepad has a given button. More...
 
bool GetButton (GamepadButton button)
 Get the current state of a button on a gamepad. More...
 
GamepadButtonLabel GetButtonLabel (GamepadButton button)
 Get the label of a button on a gamepad. More...
 
int GetNumTouchpads ()
 Get the number of touchpads on a gamepad. More...
 
int GetNumTouchpadFingers (int touchpad)
 Get the number of supported simultaneous fingers on a touchpad on a game gamepad. More...
 
void GetTouchpadFinger (int touchpad, int finger, bool *down, float *x, float *y, float *pressure)
 Get the current state of a finger on a touchpad on a gamepad. More...
 
bool HasSensor (SensorType type)
 Return whether a gamepad has a particular sensor. More...
 
void SetSensorEnabled (SensorType type, bool enabled)
 Set whether data reporting for a gamepad sensor is enabled. More...
 
bool SensorEnabled (SensorType type)
 Query whether sensor data reporting is enabled for a gamepad. More...
 
float GetSensorDataRate (SensorType type)
 Get the data rate (number of events per second) of a gamepad sensor. More...
 
void GetSensorData (SensorType type, float *data, int num_values)
 Get the current state of a gamepad sensor. More...
 
void Rumble (Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
 Start a rumble effect on a gamepad. More...
 
void RumbleTriggers (Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
 Start a rumble effect in the gamepad's triggers. More...
 
void SetLED (Uint8 red, Uint8 green, Uint8 blue)
 Update a gamepad's LED color. More...
 
void SendEffect (const void *data, int size)
 Send a gamepad specific effect packet. More...
 
const char * GetAppleSFSymbolsNameForButton (GamepadButton button)
 Return the sfSymbolsName for a given button on a gamepad on Apple platforms. More...
 
const char * GetAppleSFSymbolsNameForAxis (GamepadAxis axis)
 Return the sfSymbolsName for a given axis on a gamepad on Apple platforms. More...
 

Detailed Description

Since
This struct is available since SDL 3.2.0.
Category:
Resource

Constructor & Destructor Documentation

◆ Gamepad() [1/2]

constexpr SDL::Gamepad::Gamepad ( const GamepadRaw  resource)
inlineexplicitconstexpr
Parameters
resourcea GamepadRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.

◆ Gamepad() [2/2]

SDL::Gamepad::Gamepad ( JoystickID  instance_id)
inline
Parameters
instance_idthe joystick instance ID.
Postcondition
a gamepad identifier or nullptr if an error occurred; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Gamepad.Close
IsGamepad

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