mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 02:38:52 -05:00
Initial implementation of joystick name retrieval on Win32.
This commit is contained in:
parent
a4b3a18755
commit
7eff6b1b1e
|
@ -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…
Reference in New Issue
Block a user