From 135ed7feb4c5c7d5a3493d7f7889549088d7587b Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 31 Mar 2016 14:22:54 +0200 Subject: [PATCH] Fix build on legacy MinGW --- src/win32_joystick.c | 8 ++++---- src/win32_platform.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/win32_joystick.c b/src/win32_joystick.c index 43336a31..0268e051 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -603,9 +603,9 @@ static GLFWbool pollJoystickState(_GLFWjoystickWin32* js, int mode) if (mode == _GLFW_PRESENCE_ONLY) return GLFW_TRUE; - if (sqrtf((float) (xis.Gamepad.sThumbLX * xis.Gamepad.sThumbLX + + if (sqrt((double) (xis.Gamepad.sThumbLX * xis.Gamepad.sThumbLX + xis.Gamepad.sThumbLY * xis.Gamepad.sThumbLY)) > - (float) XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE) + (double) XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE) { js->axes[0] = (xis.Gamepad.sThumbLX + 0.5f) / 32767.f; js->axes[1] = (xis.Gamepad.sThumbLY + 0.5f) / 32767.f; @@ -616,9 +616,9 @@ static GLFWbool pollJoystickState(_GLFWjoystickWin32* js, int mode) js->axes[1] = 0.f; } - if (sqrtf((float) (xis.Gamepad.sThumbRX * xis.Gamepad.sThumbRX + + if (sqrt((double) (xis.Gamepad.sThumbRX * xis.Gamepad.sThumbRX + xis.Gamepad.sThumbRY * xis.Gamepad.sThumbRY)) > - (float) XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) + (double) XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) { js->axes[2] = (xis.Gamepad.sThumbRX + 0.5f) / 32767.f; js->axes[3] = (xis.Gamepad.sThumbRY + 0.5f) / 32767.f; diff --git a/src/win32_platform.h b/src/win32_platform.h index d0dac96d..d44ca3b9 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -64,6 +64,7 @@ // GLFW uses DirectInput8 interfaces #define DIRECTINPUT_VERSION 0x0800 +#include #include #include #include