2007-08-03 02:14:31 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
using OpenTK.Input;
|
|
|
|
|
|
|
|
|
|
namespace OpenTK
|
|
|
|
|
{
|
2007-08-04 15:28:16 +02:00
|
|
|
|
public class InputDriver : IInputDriver
|
2007-08-03 02:14:31 +02:00
|
|
|
|
{
|
|
|
|
|
IInputDriver inputDriver;
|
|
|
|
|
|
2007-08-04 15:28:16 +02:00
|
|
|
|
public InputDriver(IntPtr parentHandle)
|
2007-08-03 02:14:31 +02:00
|
|
|
|
{
|
|
|
|
|
if (Environment.OSVersion.Version.Major > 5 ||
|
|
|
|
|
(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
|
|
|
|
|
{
|
2007-08-04 14:09:58 +02:00
|
|
|
|
inputDriver = new OpenTK.Platform.Windows.WinRawInput(parentHandle);
|
2007-08-03 02:14:31 +02:00
|
|
|
|
}
|
2007-08-05 11:03:22 +02:00
|
|
|
|
else if (Environment.OSVersion.Platform == PlatformID.Unix)
|
|
|
|
|
{
|
|
|
|
|
inputDriver = new OpenTK.Platform.X11.X11Input(parentHandle);
|
|
|
|
|
}
|
2007-08-03 02:14:31 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2007-08-05 11:03:22 +02:00
|
|
|
|
throw new PlatformNotSupportedException(
|
|
|
|
|
"Input handling is not supported on the current platform. Please report the problem to http://opentk.sourceforge.net");
|
2007-08-03 02:14:31 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region --- IInputDriver Members ---
|
|
|
|
|
|
2007-08-05 11:59:42 +02:00
|
|
|
|
public IList<IInputDevice> InputDevices
|
2007-08-03 02:14:31 +02:00
|
|
|
|
{
|
|
|
|
|
get { return inputDriver.InputDevices; }
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-04 15:28:16 +02:00
|
|
|
|
public IList<Keyboard> Keyboard
|
2007-08-03 02:14:31 +02:00
|
|
|
|
{
|
2007-08-04 15:28:16 +02:00
|
|
|
|
get { return inputDriver.Keyboard; }
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-05 12:07:59 +02:00
|
|
|
|
public IList<OpenTK.Input.Mouse> Mouse
|
2007-08-04 15:28:16 +02:00
|
|
|
|
{
|
2007-08-05 11:03:22 +02:00
|
|
|
|
get { return inputDriver.Mouse; }
|
2007-08-03 02:14:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|