Fixed Joystick:getName to be more consistent

This commit is contained in:
Alex Szpakowski
2013-10-05 04:07:39 -03:00
parent 8b7f151a4d
commit 25caa188ba
+6 -4
View File
@@ -124,11 +124,13 @@ const char *Joystick::getName() const
if (!isConnected())
return name.c_str();
// Prefer SDL's GameController name, if possible.
if (isGamepad())
return SDL_GameControllerName(controller);
// Prefer the Joystick name for consistency.
const char *joyname = SDL_JoystickName(joyhandle);
return SDL_JoystickName(joyhandle);
if (!joyname && isGamepad())
joyname = SDL_GameControllerName(controller);
return joyname;
}
int Joystick::getAxisCount() const