From cb869a4fd1152749fae38bc5307df00a561f56bf Mon Sep 17 00:00:00 2001 From: Clownacy Date: Fri, 3 Apr 2020 18:13:44 +0100 Subject: [PATCH] Support GLFW <3.3 Travis's Ubuntu Bionic uses 3.2, causing it to fail. --- src/Backends/GLFW3/Controller.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Backends/GLFW3/Controller.cpp b/src/Backends/GLFW3/Controller.cpp index 345ecf95..e73b6b80 100644 --- a/src/Backends/GLFW3/Controller.cpp +++ b/src/Backends/GLFW3/Controller.cpp @@ -27,7 +27,11 @@ BOOL ControllerBackend_Init(void) for (int i = GLFW_JOYSTICK_1; i < GLFW_JOYSTICK_LAST; ++i) { +#if GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3) if (glfwJoystickPresent(i) == GLFW_TRUE && glfwJoystickIsGamepad(i) == GLFW_TRUE) +#else + if (glfwJoystickPresent(i) == GLFW_TRUE) +#endif { printf("Joystick #%d selected\n", i); joystick_connected = TRUE; @@ -44,7 +48,11 @@ BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status) if (!joystick_connected) return FALSE; +#if GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3) if (glfwJoystickPresent(connected_joystick_id) == GLFW_FALSE || glfwJoystickIsGamepad(connected_joystick_id) == GLFW_FALSE) +#else + if (glfwJoystickPresent(connected_joystick_id) == GLFW_FALSE) +#endif return FALSE; int total_axis; @@ -75,7 +83,11 @@ BOOL ControllerBackend_ResetJoystickStatus(void) if (!joystick_connected) return FALSE; +#if GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3) if (glfwJoystickPresent(connected_joystick_id) == GLFW_FALSE || glfwJoystickIsGamepad(connected_joystick_id) == GLFW_FALSE) +#else + if (glfwJoystickPresent(connected_joystick_id) == GLFW_FALSE) +#endif return FALSE; int total_axis;