Stefan Monov's picture

Two mice

I connected two mice to my PC, and printed gameWindow.InputDriver.Mouse.Count. Got "1".

Then I tried accessing RawInput directly:

[StructLayout(LayoutKind.Sequential)]
internal struct RAWINPUTDEVICELIST
{
	public IntPtr hDevice;
	[MarshalAs(UnmanagedType.U4)]
	public int dwType;
}
 
[DllImport("User32.dll")]
extern static uint GetRawInputDeviceList(IntPtr pRawInputDeviceList, ref uint uiNumDevices, uint cbSize);
 
public static void Main(string[] args)
{
	int dwSize = ( Marshal.SizeOf( typeof( RAWINPUTDEVICELIST )));
	uint deviceCount = 0;
 
	GetRawInputDeviceList( IntPtr.Zero, ref deviceCount, (uint)dwSize );
	Console.WriteLine("deviceCount = {0}", deviceCount);
}

The result was "6". Then I disconnected the second mouse just in case, and I got "5" as expected. So the problem seems to be in OpenTK.

Any idea?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Stefan Monov's picture

Ah, looks like the RawInput implementation is unused in OpenTK right now. OpenTK.Platform.Windows.WinFactory just creates a WinGLNative, which doesn't use the OpenTK.Input.InputDriver class, so WinRawInput isn't used.

Is that right? Is RawInput unsupported?

the Fiddler's picture

Check out svn trunk and use OpenTK.Input.Mouse instead of GameWindow.Mouse. This provides multiple mice on all operating systems!

Stefan Monov's picture

Thanks. How stable is svn trunk usually?

puklaus's picture

Always used svn-version and it's stable (and if something does not work right, write bug report right away, so it will be fixed to svn).