Separate joystick power state into battery status and percentage

This allows you to see battery percentage while the controller is charging
This commit is contained in:
Sam Lantinga
2024-03-30 10:55:13 -07:00
parent 5e624c2083
commit 8847b35244
42 changed files with 596 additions and 1001 deletions

View File

@@ -232,6 +232,7 @@ SDL3_0.0.0 {
SDL_GetGamepadButtonFromString;
SDL_GetGamepadButtonLabel;
SDL_GetGamepadButtonLabelForType;
SDL_GetGamepadConnectionState;
SDL_GetGamepadFirmwareVersion;
SDL_GetGamepadFromInstanceID;
SDL_GetGamepadFromPlayerIndex;
@@ -252,7 +253,7 @@ SDL3_0.0.0 {
SDL_GetGamepadName;
SDL_GetGamepadPath;
SDL_GetGamepadPlayerIndex;
SDL_GetGamepadPowerLevel;
SDL_GetGamepadPowerInfo;
SDL_GetGamepadProduct;
SDL_GetGamepadProductVersion;
SDL_GetGamepadProperties;
@@ -287,6 +288,7 @@ SDL3_0.0.0 {
SDL_GetJoystickAxisInitialState;
SDL_GetJoystickBall;
SDL_GetJoystickButton;
SDL_GetJoystickConnectionState;
SDL_GetJoystickFirmwareVersion;
SDL_GetJoystickFromInstanceID;
SDL_GetJoystickFromPlayerIndex;
@@ -307,7 +309,7 @@ SDL3_0.0.0 {
SDL_GetJoystickName;
SDL_GetJoystickPath;
SDL_GetJoystickPlayerIndex;
SDL_GetJoystickPowerLevel;
SDL_GetJoystickPowerInfo;
SDL_GetJoystickProduct;
SDL_GetJoystickProductVersion;
SDL_GetJoystickProperties;

View File

@@ -257,6 +257,7 @@
#define SDL_GetGamepadButtonFromString SDL_GetGamepadButtonFromString_REAL
#define SDL_GetGamepadButtonLabel SDL_GetGamepadButtonLabel_REAL
#define SDL_GetGamepadButtonLabelForType SDL_GetGamepadButtonLabelForType_REAL
#define SDL_GetGamepadConnectionState SDL_GetGamepadConnectionState_REAL
#define SDL_GetGamepadFirmwareVersion SDL_GetGamepadFirmwareVersion_REAL
#define SDL_GetGamepadFromInstanceID SDL_GetGamepadFromInstanceID_REAL
#define SDL_GetGamepadFromPlayerIndex SDL_GetGamepadFromPlayerIndex_REAL
@@ -277,7 +278,7 @@
#define SDL_GetGamepadName SDL_GetGamepadName_REAL
#define SDL_GetGamepadPath SDL_GetGamepadPath_REAL
#define SDL_GetGamepadPlayerIndex SDL_GetGamepadPlayerIndex_REAL
#define SDL_GetGamepadPowerLevel SDL_GetGamepadPowerLevel_REAL
#define SDL_GetGamepadPowerInfo SDL_GetGamepadPowerInfo_REAL
#define SDL_GetGamepadProduct SDL_GetGamepadProduct_REAL
#define SDL_GetGamepadProductVersion SDL_GetGamepadProductVersion_REAL
#define SDL_GetGamepadProperties SDL_GetGamepadProperties_REAL
@@ -312,6 +313,7 @@
#define SDL_GetJoystickAxisInitialState SDL_GetJoystickAxisInitialState_REAL
#define SDL_GetJoystickBall SDL_GetJoystickBall_REAL
#define SDL_GetJoystickButton SDL_GetJoystickButton_REAL
#define SDL_GetJoystickConnectionState SDL_GetJoystickConnectionState_REAL
#define SDL_GetJoystickFirmwareVersion SDL_GetJoystickFirmwareVersion_REAL
#define SDL_GetJoystickFromInstanceID SDL_GetJoystickFromInstanceID_REAL
#define SDL_GetJoystickFromPlayerIndex SDL_GetJoystickFromPlayerIndex_REAL
@@ -332,7 +334,7 @@
#define SDL_GetJoystickName SDL_GetJoystickName_REAL
#define SDL_GetJoystickPath SDL_GetJoystickPath_REAL
#define SDL_GetJoystickPlayerIndex SDL_GetJoystickPlayerIndex_REAL
#define SDL_GetJoystickPowerLevel SDL_GetJoystickPowerLevel_REAL
#define SDL_GetJoystickPowerInfo SDL_GetJoystickPowerInfo_REAL
#define SDL_GetJoystickProduct SDL_GetJoystickProduct_REAL
#define SDL_GetJoystickProductVersion SDL_GetJoystickProductVersion_REAL
#define SDL_GetJoystickProperties SDL_GetJoystickProperties_REAL

View File

@@ -295,6 +295,7 @@ SDL_DYNAPI_PROC(Uint8,SDL_GetGamepadButton,(SDL_Gamepad *a, SDL_GamepadButton b)
SDL_DYNAPI_PROC(SDL_GamepadButton,SDL_GetGamepadButtonFromString,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_GamepadButtonLabel,SDL_GetGamepadButtonLabel,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GamepadButtonLabel,SDL_GetGamepadButtonLabelForType,(SDL_GamepadType a, SDL_GamepadButton b),(a,b),return)
SDL_DYNAPI_PROC(SDL_JoystickConnectionState,SDL_GetGamepadConnectionState,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadFirmwareVersion,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_GetGamepadFromInstanceID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_GetGamepadFromPlayerIndex,(int a),(a),return)
@@ -315,7 +316,7 @@ SDL_DYNAPI_PROC(char**,SDL_GetGamepadMappings,(int *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadName,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadPath,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetGamepadPlayerIndex,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_GetGamepadPowerLevel,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetGamepadPowerInfo,(SDL_Gamepad *a, int *b),(a,b),return)
SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadProduct,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadProductVersion,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGamepadProperties,(SDL_Gamepad *a),(a),return)
@@ -350,6 +351,7 @@ SDL_DYNAPI_PROC(Sint16,SDL_GetJoystickAxis,(SDL_Joystick *a, int b),(a,b),return
SDL_DYNAPI_PROC(SDL_bool,SDL_GetJoystickAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_GetJoystickBall,(SDL_Joystick *a, int b, int *c, int *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(Uint8,SDL_GetJoystickButton,(SDL_Joystick *a, int b),(a,b),return)
SDL_DYNAPI_PROC(SDL_JoystickConnectionState,SDL_GetJoystickConnectionState,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickFirmwareVersion,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetJoystickFromInstanceID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetJoystickFromPlayerIndex,(int a),(a),return)
@@ -370,7 +372,7 @@ SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickInstanceVendor,(SDL_JoystickID a),(a),retu
SDL_DYNAPI_PROC(const char*,SDL_GetJoystickName,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetJoystickPath,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetJoystickPlayerIndex,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_GetJoystickPowerLevel,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetJoystickPowerInfo,(SDL_Joystick *a, int *b),(a,b),return)
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickProduct,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickProductVersion,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetJoystickProperties,(SDL_Joystick *a),(a),return)