Explorar o código

Fixed overflow in trigger rumble calculation

Sam Lantinga %!s(int64=4) %!d(string=hai) anos
pai
achega
e749c1266f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      test/testgamecontroller.c

+ 1 - 1
test/testgamecontroller.c

@@ -117,7 +117,7 @@ UpdateWindowTitle()
 static Uint16 ConvertAxisToRumble(Sint16 axis)
 {
     /* Only start rumbling if the axis is past the halfway point */
-    const int half_axis = (SDL_JOYSTICK_AXIS_MAX / 2);
+    const Sint16 half_axis = (Sint16)SDL_ceil(SDL_JOYSTICK_AXIS_MAX / 2.0f);
     if (axis > half_axis) {
         return (Uint16)(axis - half_axis) * 4;
     } else {