[+] GLFWAPI DWORD glfwGetXInputIndexJoystick(int jid);
[+] GLFWAPI int glfwGetLinuxFdJoystick(int jid);
This commit is contained in:
parent
9ffdc4e8ab
commit
1261ff639d
@ -188,6 +188,12 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||
|
||||
GLFWAPI DWORD glfwGetXInputIndexJoystick(int jid);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_LINUX)
|
||||
GLFWAPI int glfwGetLinuxFdJoystick(int jid);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
|
||||
|
@ -438,5 +438,27 @@ void _glfwUpdateGamepadGUIDLinux(char* guid)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWAPI int glfwGetLinuxFdJoystick(int jid)
|
||||
{
|
||||
_GLFWjoystick* js;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||
|
||||
if (jid < 0 || jid > GLFW_JOYSTICK_LAST)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
js = _glfw.joysticks + jid;
|
||||
if (!js->connected)
|
||||
return 0;
|
||||
|
||||
if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_ALL))
|
||||
return 0;
|
||||
|
||||
return js->linjs.fd;
|
||||
}
|
||||
|
||||
#endif // GLFW_BUILD_LINUX_JOYSTICK
|
||||
|
||||
|
@ -766,5 +766,28 @@ void _glfwUpdateGamepadGUIDWin32(char* guid)
|
||||
}
|
||||
}
|
||||
|
||||
GLFWAPI DWORD glfwGetXInputIndexJoystick(int jid)
|
||||
{
|
||||
_GLFWjoystick* js;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(0xFFFFFFFFul);
|
||||
|
||||
if (jid < 0 || jid > GLFW_JOYSTICK_LAST)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick ID %i", jid);
|
||||
return 0xFFFFFFFFul;
|
||||
}
|
||||
|
||||
js = _glfw.joysticks + jid;
|
||||
if (!js->connected)
|
||||
return 0xFFFFFFFFul;
|
||||
|
||||
if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_ALL))
|
||||
return 0xFFFFFFFFul;
|
||||
|
||||
return js->win32.index;
|
||||
}
|
||||
|
||||
|
||||
#endif // _GLFW_WIN32
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user