Procházet zdrojové kódy

Fix build on legacy MinGW

Camilla Berglund před 9 roky
rodič
revize
135ed7feb4
2 změnil soubory, kde provedl 5 přidání a 4 odebrání
  1. 4 4
      src/win32_joystick.c
  2. 1 0
      src/win32_platform.h

+ 4 - 4
src/win32_joystick.c

@@ -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;

+ 1 - 0
src/win32_platform.h

@@ -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>