2007-08-10 09:27:13 +00:00
|
|
|
|
#region --- License ---
|
|
|
|
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
|
|
|
|
* See license.txt for license info
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
using System;
|
2007-08-03 00:14:31 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
using OpenTK.Input;
|
2007-08-05 13:42:31 +00:00
|
|
|
|
using OpenTK.Platform;
|
2007-08-03 00:14:31 +00:00
|
|
|
|
|
|
|
|
|
namespace OpenTK
|
|
|
|
|
{
|
2007-08-04 13:28:16 +00:00
|
|
|
|
public class InputDriver : IInputDriver
|
2007-08-03 00:14:31 +00:00
|
|
|
|
{
|
|
|
|
|
IInputDriver inputDriver;
|
|
|
|
|
|
2007-08-10 16:55:24 +00:00
|
|
|
|
#region --- Constructors ---
|
|
|
|
|
|
2007-08-05 13:42:31 +00:00
|
|
|
|
public InputDriver(IWindowInfo parent)
|
2007-08-03 00:14:31 +00:00
|
|
|
|
{
|
|
|
|
|
if (Environment.OSVersion.Version.Major > 5 ||
|
|
|
|
|
(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
|
|
|
|
|
{
|
2007-08-06 11:22:18 +00:00
|
|
|
|
inputDriver = new OpenTK.Platform.Windows.WinRawInput(parent as OpenTK.Platform.Windows.WindowInfo);
|
2007-08-03 00:14:31 +00:00
|
|
|
|
}
|
2007-08-05 09:03:22 +00:00
|
|
|
|
else if (Environment.OSVersion.Platform == PlatformID.Unix)
|
|
|
|
|
{
|
2007-08-05 13:42:31 +00:00
|
|
|
|
inputDriver =
|
|
|
|
|
new OpenTK.Platform.X11.X11Input(parent as OpenTK.Platform.X11.WindowInfo);
|
2007-08-05 09:03:22 +00:00
|
|
|
|
}
|
2007-08-03 00:14:31 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2007-08-05 09:03:22 +00: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 00:14:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-08-10 16:55:24 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2007-08-03 00:14:31 +00:00
|
|
|
|
|
|
|
|
|
#region --- IInputDriver Members ---
|
|
|
|
|
|
2007-08-05 09:59:42 +00:00
|
|
|
|
public IList<IInputDevice> InputDevices
|
2007-08-03 00:14:31 +00:00
|
|
|
|
{
|
|
|
|
|
get { return inputDriver.InputDevices; }
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-04 13:28:16 +00:00
|
|
|
|
public IList<Keyboard> Keyboard
|
2007-08-03 00:14:31 +00:00
|
|
|
|
{
|
2007-08-04 13:28:16 +00:00
|
|
|
|
get { return inputDriver.Keyboard; }
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-05 10:07:59 +00:00
|
|
|
|
public IList<OpenTK.Input.Mouse> Mouse
|
2007-08-04 13:28:16 +00:00
|
|
|
|
{
|
2007-08-05 09:03:22 +00:00
|
|
|
|
get { return inputDriver.Mouse; }
|
2007-08-03 00:14:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-05 18:26:14 +00:00
|
|
|
|
public void ProcessEvents()
|
|
|
|
|
{
|
|
|
|
|
inputDriver.ProcessEvents();
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-03 00:14:31 +00:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|