Skip to content

Commit 75a4c5b

Browse files
author
Asdqwe
authored
Update core_input_gamepad example (#4416)
1 parent ebcfc7f commit 75a4c5b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/core/core_input_gamepad.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include "raylib.h"
2121

2222
// NOTE: Gamepad name ID depends on drivers and OS
23-
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
24-
#define XBOX360_NAME_ID "Xbox 360 Controller"
25-
#define PS3_NAME_ID "Sony PLAYSTATION(R)3 Controller"
23+
#define XBOX_ALIAS_1 "xbox"
24+
#define XBOX_ALIAS_2 "x-box"
25+
#define PS_ALIAS "playstation"
2626

2727
//------------------------------------------------------------------------------------
2828
// Program main entry point
@@ -67,7 +67,7 @@ int main(void)
6767
{
6868
DrawText(TextFormat("GP%d: %s", gamepad, GetGamepadName(gamepad)), 10, 10, 10, BLACK);
6969

70-
if (TextIsEqual(GetGamepadName(gamepad), XBOX360_LEGACY_NAME_ID) || TextIsEqual(GetGamepadName(gamepad), XBOX360_NAME_ID))
70+
if (TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_1) > -1 || TextFindIndex(TextToLower(GetGamepadName(gamepad)), XBOX_ALIAS_2) > -1)
7171
{
7272
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
7373

@@ -120,7 +120,7 @@ int main(void)
120120
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
121121
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(gamepad, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
122122
}
123-
else if (TextIsEqual(GetGamepadName(gamepad), PS3_NAME_ID))
123+
else if (TextFindIndex(TextToLower(GetGamepadName(gamepad)), PS_ALIAS) > -1)
124124
{
125125
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
126126

0 commit comments

Comments
 (0)