From 6809f06b55abdf5b7c3a15ba729b4d63109b9e73 Mon Sep 17 00:00:00 2001 From: MichaelFiber Date: Mon, 18 Sep 2023 16:17:51 -0400 Subject: [PATCH] Move GetGamepadAxisCount from rcore --- src/rcore.c | 12 ------------ src/rcore_android.c | 7 +++++++ src/rcore_desktop.c | 7 +++++++ src/rcore_drm.c | 10 ++++++++++ src/rcore_web.c | 7 +++++++ 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 23f4f7790..0f17bbb14 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1961,18 +1961,6 @@ bool IsGamepadAvailable(int gamepad) return result; } -// Get gamepad axis count -int GetGamepadAxisCount(int gamepad) -{ -#if defined(PLATFORM_DRM) - int axisCount = 0; - if (CORE.Input.Gamepad.ready[gamepad]) ioctl(CORE.Input.Gamepad.streamId[gamepad], JSIOCGAXES, &axisCount); - CORE.Input.Gamepad.axisCount = axisCount; -#endif - - return CORE.Input.Gamepad.axisCount; -} - // Get axis movement vector for a gamepad float GetGamepadAxisMovement(int gamepad, int axis) { diff --git a/src/rcore_android.c b/src/rcore_android.c index c336009e6..6950f53f2 100644 --- a/src/rcore_android.c +++ b/src/rcore_android.c @@ -1640,3 +1640,10 @@ int GetMonitorPhysicalWidth(int monitor) { return 0; } + + +// Get gamepad axis count +int GetGamepadAxisCount(int gamepad) +{ + return CORE.Input.Gamepad.axisCount; +} diff --git a/src/rcore_desktop.c b/src/rcore_desktop.c index 754a3668f..61c8f05f8 100644 --- a/src/rcore_desktop.c +++ b/src/rcore_desktop.c @@ -1524,3 +1524,10 @@ int GetMonitorPhysicalWidth(int monitor) else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor"); return 0; } + + +// Get gamepad axis count +int GetGamepadAxisCount(int gamepad) +{ + return CORE.Input.Gamepad.axisCount; +} diff --git a/src/rcore_drm.c b/src/rcore_drm.c index 193f2335f..40d05dae0 100644 --- a/src/rcore_drm.c +++ b/src/rcore_drm.c @@ -962,3 +962,13 @@ int GetMonitorPhysicalWidth(int monitor) { return 0; } + + +// Get gamepad axis count +int GetGamepadAxisCount(int gamepad) +{ + int axisCount = 0; + if (CORE.Input.Gamepad.ready[gamepad]) ioctl(CORE.Input.Gamepad.streamId[gamepad], JSIOCGAXES, &axisCount); + CORE.Input.Gamepad.axisCount = axisCount; + return CORE.Input.Gamepad.axisCount; +} diff --git a/src/rcore_web.c b/src/rcore_web.c index 9e9deb5ca..0df95548f 100644 --- a/src/rcore_web.c +++ b/src/rcore_web.c @@ -1562,3 +1562,10 @@ int GetMonitorPhysicalWidth(int monitor) { return 0; } + + +// Get gamepad axis count +int GetGamepadAxisCount(int gamepad) +{ + return CORE.Input.Gamepad.axisCount; +}