WinMM devices with 0 axes and no POV hats are not joysticks/joypads.

This commit is contained in:
the_fiddler 2009-03-07 05:55:33 +00:00
parent ebc3490243
commit b958f912a8

View file

@ -32,6 +32,7 @@ using System.Runtime.InteropServices;
using OpenTK.Input;
using System.Security;
using Microsoft.Win32;
using System.Diagnostics;
namespace OpenTK.Platform.Windows
{
@ -85,6 +86,12 @@ namespace OpenTK.Platform.Windows
if ((caps.Capabilities & JoystCapsFlags.HasPov) != 0)
num_axes += 2;
if (num_axes == 0)
{
Debug.Print("WinMM device {0} has 0 axes. Device will not be used.");
return null;
}
stick = new JoystickDevice<WinMMJoyDetails>(number, num_axes, caps.NumButtons);
stick.Details = new WinMMJoyDetails(num_axes);