Parcourir la source

Fix controller not available right after win init (#5358)

- Fix IsGamepadAvailable() returns false for an available controller immediately after window initialization
pull/5362/head
Serhii Zasenko il y a 1 mois
committed by GitHub
Parent
révision
be9a24e68c
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: B5690EEEBB952194
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. +6
    -1
      src/platforms/rcore_desktop_glfw.c

+ 6
- 1
src/platforms/rcore_desktop_glfw.c Voir le fichier

@ -1749,7 +1749,12 @@ int InitPlatform(void)
{
// WARNING: If glfwGetJoystickName() is longer than MAX_GAMEPAD_NAME_LENGTH,
// we can get a not-NULL terminated string, so, we only copy up to (MAX_GAMEPAD_NAME_LENGTH - 1)
if (glfwJoystickPresent(i)) strncpy(CORE.Input.Gamepad.name[i], glfwGetJoystickName(i), MAX_GAMEPAD_NAME_LENGTH - 1);
if (glfwJoystickPresent(i))
{
CORE.Input.Gamepad.ready[i] = true;
CORE.Input.Gamepad.axisCount[i] = GLFW_GAMEPAD_AXIS_LAST + 1;
strncpy(CORE.Input.Gamepad.name[i], glfwGetJoystickName(i), MAX_GAMEPAD_NAME_LENGTH - 1);
}
}
//----------------------------------------------------------------------------

Chargement…
Annuler
Enregistrer