* Source/OpenTK/Input/Mouse.cs:

* Source/OpenTK/Platform/Factory.cs:
* Source/OpenTK/Input/InputDriver.cs:
* Source/OpenTK/Input/IMouseDriver.cs:
* Source/OpenTK/Platform/X11/X11Input.cs:
* Source/OpenTK/Platform/X11/X11Factory.cs:
* Source/OpenTK/Platform/Windows/WMInput.cs:
* Source/OpenTK/Platform/IPlatformFactory.cs:
* Source/OpenTK/Platform/MacOS/CarbonInput.cs:
* Source/OpenTK/Platform/Windows/WinFactory.cs:
* Source/OpenTK/Platform/MacOS/MacOSFactory.cs:
* Source/OpenTK/Platform/Windows/WinGLNative.cs:
* Source/OpenTK/Platform/Windows/WinRawMouse.cs:
* Source/OpenTK/Platform/Windows/WinRawInput.cs: Added new MouseDriver
  interface and added stub internal implementations.
This commit is contained in:
the_fiddler 2010-10-20 14:58:38 +00:00
parent 7e3182b1fc
commit 85c37f0600
14 changed files with 126 additions and 13 deletions

View file

@ -19,5 +19,18 @@ namespace OpenTK.Input
/// Gets the list of available MouseDevices.
/// </summary>
IList<MouseDevice> Mouse { get; }
/// <summary>
/// Retrieves the MouseState for the default keyboard device.
/// </summary>
/// <returns>A <see cref="OpenTK.Input.MouseState"/> structure containing the state of the mouse device.</returns>
MouseState GetState();
/// <summary>
/// Retrieves the MouseState for the specified keyboard device.
/// </summary>
/// <param name="index">The index of the keyboard device.</param>
/// <returns>A <see cref="OpenTK.Input.MouseState"/> structure containing the state of the mouse device.</returns>
MouseState GetState(int index);
}
}

View file

@ -75,12 +75,12 @@ namespace OpenTK
public KeyboardState GetState()
{
return inputDriver.GetState();
return (inputDriver as IKeyboardDriver).GetState();
}
public KeyboardState GetState(int index)
{
return inputDriver.GetState(index);
return (inputDriver as IKeyboardDriver).GetState(index);
}
#endregion
@ -92,6 +92,16 @@ namespace OpenTK
get { return inputDriver.Mouse; }
}
MouseState IMouseDriver.GetState()
{
throw new NotImplementedException();
}
MouseState IMouseDriver.GetState(int index)
{
throw new NotImplementedException();
}
#endregion
#region --- IJoystickDriver Members ---

View file

@ -38,20 +38,22 @@ namespace OpenTK.Input
{
#region Fields
//static IMouseDriver driver;
#endregion
#region Constructors
static Mouse()
{
}
static readonly IMouseDriver driver =
Platform.Factory.Default.CreateMouseDriver();
#endregion
#region Public Members
/// <summary>
/// Retrieves the MouseState for the specified mouse device.
/// </summary>
/// <returns>A <see cref="OpenTK.Input.MouseState"/> structure containing the state of the mouse device.</returns>
public static MouseState GetState()
{
return driver.GetState();
}
/// <summary>
/// Retrieves the MouseState for the specified mouse device.
/// </summary>
@ -59,7 +61,7 @@ namespace OpenTK.Input
/// <returns>A <see cref="OpenTK.Input.MouseState"/> structure containing the state of the mouse device.</returns>
public static MouseState GetState(int index)
{
throw new NotImplementedException();
return driver.GetState(index);
}
#endregion

View file

@ -119,6 +119,11 @@ namespace OpenTK.Platform
return default_implementation.CreateKeyboardDriver();
}
public OpenTK.Input.IMouseDriver CreateMouseDriver()
{
return default_implementation.CreateMouseDriver();
}
class UnsupportedPlatform : IPlatformFactory
{
#region Fields
@ -168,6 +173,11 @@ namespace OpenTK.Platform
{
throw new PlatformNotSupportedException(error_string);
}
public OpenTK.Input.IMouseDriver CreateMouseDriver()
{
throw new PlatformNotSupportedException(error_string);
}
#endregion
}

View file

@ -48,5 +48,7 @@ namespace OpenTK.Platform
IGraphicsMode CreateGraphicsMode();
OpenTK.Input.IKeyboardDriver CreateKeyboardDriver();
OpenTK.Input.IMouseDriver CreateMouseDriver();
}
}

View file

@ -54,6 +54,16 @@ namespace OpenTK.Platform.MacOS
get { return dummy_mice_list; }
}
MouseState IMouseDriver.GetState()
{
throw new NotImplementedException();
}
MouseState IMouseDriver.GetState(int index)
{
throw new NotImplementedException();
}
#endregion
#region IJoystickDriver Members

View file

@ -74,7 +74,12 @@ namespace OpenTK.Platform.MacOS
{
throw new NotImplementedException();
}
public virtual OpenTK.Input.IMouseDriver CreateMouseDriver()
{
throw new NotImplementedException();
}
#endregion
}
}

View file

@ -265,6 +265,16 @@ namespace OpenTK.Platform.Windows
get { return mice; }
}
MouseState IMouseDriver.GetState()
{
throw new NotImplementedException();
}
MouseState IMouseDriver.GetState(int index)
{
throw new NotImplementedException();
}
#endregion
#region IJoystickDriver Members

View file

@ -80,6 +80,11 @@ namespace OpenTK.Platform.Windows
else
return new WMInput(null);
}
public virtual OpenTK.Input.IMouseDriver CreateMouseDriver()
{
throw new NotImplementedException();
}
#endregion
}

View file

@ -1205,6 +1205,16 @@ namespace OpenTK.Platform.Windows
get { return mice; }
}
MouseState IMouseDriver.GetState()
{
throw new NotImplementedException();
}
MouseState IMouseDriver.GetState(int index)
{
throw new NotImplementedException();
}
#endregion
#region IJoystickDriver Members

View file

@ -226,6 +226,16 @@ namespace OpenTK.Platform.Windows
get { return mouseDriver.Mouse; }
}
MouseState IMouseDriver.GetState()
{
throw new NotImplementedException();
}
MouseState IMouseDriver.GetState(int index)
{
throw new NotImplementedException();
}
#endregion
#region IJoystickDriver Members

View file

@ -52,6 +52,16 @@ namespace OpenTK.Platform.Windows
get { return mice; }
}
public MouseState GetState()
{
throw new NotImplementedException();
}
public MouseState GetState(int index)
{
throw new NotImplementedException();
}
#region public int RegisterDevices()
public int RegisterDevices()

View file

@ -83,6 +83,12 @@ namespace OpenTK.Platform.X11
return new X11Keyboard(null);
}
public virtual OpenTK.Input.IMouseDriver CreateMouseDriver()
{
//return new X11Mouse(null);
throw new NotImplementedException();
}
#endregion
}
}

View file

@ -238,6 +238,16 @@ namespace OpenTK.Platform.X11
get { return (IList<MouseDevice>)dummy_mice_list; } //return mouseDriver.Mouse;
}
MouseState IMouseDriver.GetState()
{
throw new NotImplementedException();
}
MouseState IMouseDriver.GetState(int index)
{
throw new NotImplementedException();
}
#endregion
#region public IList<JoystickDevice> Joysticks