Fix build on legacy MinGW

This commit is contained in:
Camilla Berglund 2016-03-31 14:22:54 +02:00
parent bd345164d3
commit 135ed7feb4
2 changed files with 5 additions and 4 deletions

View File

@ -603,9 +603,9 @@ static GLFWbool pollJoystickState(_GLFWjoystickWin32* js, int mode)
if (mode == _GLFW_PRESENCE_ONLY) if (mode == _GLFW_PRESENCE_ONLY)
return GLFW_TRUE; 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)) > 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[0] = (xis.Gamepad.sThumbLX + 0.5f) / 32767.f;
js->axes[1] = (xis.Gamepad.sThumbLY + 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; 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)) > 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[2] = (xis.Gamepad.sThumbRX + 0.5f) / 32767.f;
js->axes[3] = (xis.Gamepad.sThumbRY + 0.5f) / 32767.f; js->axes[3] = (xis.Gamepad.sThumbRY + 0.5f) / 32767.f;

View File

@ -64,6 +64,7 @@
// GLFW uses DirectInput8 interfaces // GLFW uses DirectInput8 interfaces
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
#include <wctype.h>
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <dinput.h> #include <dinput.h>