summaryrefslogtreecommitdiffhomepage
path: root/examples/core
diff options
context:
space:
mode:
authorRabia Alhaffar <[email protected]>2021-02-18 22:52:39 +0200
committerGitHub <[email protected]>2021-02-18 21:52:39 +0100
commitd96b422809d84e445e9d581ea359b491f50dbddc (patch)
tree9a184eace7209be07cfe75f0b77df3db0e10b69e /examples/core
parent0f5aab3a1ca2ffaae6c6e784d485007d7d6e7182 (diff)
downloadraylib-d96b422809d84e445e9d581ea359b491f50dbddc.tar.gz
raylib-d96b422809d84e445e9d581ea359b491f50dbddc.zip
Fixed example doesn't show gamepad for Xbox 360 controllers with different drivers (#1597)
Diffstat (limited to 'examples/core')
-rw-r--r--examples/core/core_input_gamepad.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/core/core_input_gamepad.c b/examples/core/core_input_gamepad.c
index bf9d219c..eb9b1b11 100644
--- a/examples/core/core_input_gamepad.c
+++ b/examples/core/core_input_gamepad.c
@@ -19,11 +19,12 @@
// NOTE: Gamepad name ID depends on drivers and OS
#if defined(PLATFORM_RPI)
- #define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
- #define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
+ #define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
+ #define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
#else
- #define XBOX360_NAME_ID "Xbox 360 Controller"
- #define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
+ #define XBOX360_NAME_ID "Xbox 360 Controller"
+ #define XBOX360_LEGACY_NAME_ID "Xbox Controller"
+ #define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
#endif
int main(void)
@@ -61,7 +62,7 @@ int main(void)
{
DrawText(TextFormat("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
- if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
+ if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID) || IsGamepadName(GAMEPAD_PLAYER1, XBOX360_LEGACY_NAME_ID))
{
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
@@ -191,4 +192,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
-} \ No newline at end of file
+}