* 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 e801660ff7
commit 86588ea60c
14 changed files with 126 additions and 13 deletions

View file

@ -19,5 +19,18 @@ namespace OpenTK.Input
/// Gets the list of available MouseDevices. /// Gets the list of available MouseDevices.
/// </summary> /// </summary>
IList<MouseDevice> Mouse { get; } 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() public KeyboardState GetState()
{ {
return inputDriver.GetState(); return (inputDriver as IKeyboardDriver).GetState();
} }
public KeyboardState GetState(int index) public KeyboardState GetState(int index)
{ {
return inputDriver.GetState(index); return (inputDriver as IKeyboardDriver).GetState(index);
} }
#endregion #endregion
@ -92,6 +92,16 @@ namespace OpenTK
get { return inputDriver.Mouse; } get { return inputDriver.Mouse; }
} }
MouseState IMouseDriver.GetState()
{
throw new NotImplementedException();
}
MouseState IMouseDriver.GetState(int index)
{
throw new NotImplementedException();
}
#endregion #endregion
#region --- IJoystickDriver Members --- #region --- IJoystickDriver Members ---

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -238,6 +238,16 @@ namespace OpenTK.Platform.X11
get { return (IList<MouseDevice>)dummy_mice_list; } //return mouseDriver.Mouse; 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 #endregion
#region public IList<JoystickDevice> Joysticks #region public IList<JoystickDevice> Joysticks