diff --git a/Source/OpenTK/Platform/Windows/WinMMJoystick.cs b/Source/OpenTK/Platform/Windows/WinMMJoystick.cs index a1a39c77..021107e5 100644 --- a/Source/OpenTK/Platform/Windows/WinMMJoystick.cs +++ b/Source/OpenTK/Platform/Windows/WinMMJoystick.cs @@ -89,18 +89,16 @@ namespace OpenTK.Platform.Windows stick.Details = new WinMMJoyDetails(num_axes); // Make sure to reverse the vertical axes, so that +1 points up and -1 points down. - // I don't know if this an artifact of my joypad, but RAxis is the second horizontal and - // ZAxis is the second vertical axis here (Saitek P880). int axis = 0; if (axis < caps.NumAxes) { stick.Details.Min[axis] = caps.XMin; stick.Details.Max[axis] = caps.XMax; axis++; } if (axis < caps.NumAxes) { stick.Details.Min[axis] = caps.YMax; stick.Details.Max[axis] = caps.YMin; axis++; } if (axis < caps.NumAxes) - { stick.Details.Min[axis] = caps.RMin; stick.Details.Max[axis] = caps.RMax; axis++; } - if (axis < caps.NumAxes) { stick.Details.Min[axis] = caps.ZMax; stick.Details.Max[axis] = caps.ZMin; axis++; } if (axis < caps.NumAxes) + { stick.Details.Min[axis] = caps.RMin; stick.Details.Max[axis] = caps.RMax; axis++; } + if (axis < caps.NumAxes) { stick.Details.Min[axis] = caps.UMin; stick.Details.Max[axis] = caps.UMax; axis++; } if (axis < caps.NumAxes) { stick.Details.Min[axis] = caps.VMax; stick.Details.Max[axis] = caps.VMin; axis++; } diff --git a/Source/OpenTK/Platform/X11/X11Joystick.cs b/Source/OpenTK/Platform/X11/X11Joystick.cs index 04cb448f..01d5079f 100644 --- a/Source/OpenTK/Platform/X11/X11Joystick.cs +++ b/Source/OpenTK/Platform/X11/X11Joystick.cs @@ -58,7 +58,7 @@ namespace OpenTK.Platform.X11 JoystickDevice stick = OpenJoystick(JoystickPath, number++); if (stick != null) { - stick.Description = String.Format("USB Joystick {0} ({1} axes, {2} buttons, {3})", + stick.Description = String.Format("USB Joystick {0} ({1} axes, {2} buttons, {3}{0})", number, stick.Axis.Count, stick.Button.Count, JoystickPath); sticks.Add(stick); } @@ -70,7 +70,7 @@ namespace OpenTK.Platform.X11 JoystickDevice stick = OpenJoystick(JoystickPathLegacy, number++); if (stick != null) { - stick.Description = String.Format("USB Joystick {0} ({1} axes, {2} buttons, {3})", + stick.Description = String.Format("USB Joystick {0} ({1} axes, {2} buttons, {3}{0})", number, stick.Axis.Count, stick.Button.Count, JoystickPathLegacy); sticks.Add(stick); } @@ -106,7 +106,11 @@ namespace OpenTK.Platform.X11 switch (e.Type) { case JoystickEventType.Axis: - js.SetAxis((JoystickAxis)e.Number, e.Value / 32767.0f); + // Flip vertical axes so that +1 point up. + if (e.Number % 2 == 0) + js.SetAxis((JoystickAxis)e.Number, e.Value / 32767.0f); + else + js.SetAxis((JoystickAxis)e.Number, -e.Value / 32767.0f); break; case JoystickEventType.Button: