Initial implementation of joystick name retrieval on Win32.

master
Camilla Berglund ago%!(EXTRA string=13 years)
parent a4b3a18755
commit 7eff6b1b1e
  1. 13
      src/win32_joystick.c
  2. 2
      src/win32_platform.h

@ -225,6 +225,17 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
const char* _glfwPlatformGetJoystickName(int joy)
{
return "";
JOYCAPS jc;
const int i = joy - GLFW_JOYSTICK_1;
if (!isJoystickPresent(joy))
return NULL;
_glfw_joyGetDevCaps(i, &jc, sizeof(JOYCAPS));
free(_glfwLibrary.Win32.joyNames[i]);
_glfwLibrary.Win32.joyNames[i] = _glfwCreateUTF8FromWideString(jc.szPname);
return _glfwLibrary.Win32.joyNames[i];
}

@ -208,6 +208,8 @@ typedef struct _GLFWlibraryWin32
} winmm;
#endif // _GLFW_NO_DLOAD_WINMM
char* joyNames[GLFW_JOYSTICK_LAST + 1];
} _GLFWlibraryWin32;

Loading…
Cancel
Save