diff --git a/Source/OpenTK/Input/IMouseDriver.cs b/Source/OpenTK/Input/IMouseDriver.cs index 52abe7af..9e60a5db 100644 --- a/Source/OpenTK/Input/IMouseDriver.cs +++ b/Source/OpenTK/Input/IMouseDriver.cs @@ -19,5 +19,18 @@ namespace OpenTK.Input /// Gets the list of available MouseDevices. /// IList Mouse { get; } + + /// + /// Retrieves the MouseState for the default keyboard device. + /// + /// A structure containing the state of the mouse device. + MouseState GetState(); + + /// + /// Retrieves the MouseState for the specified keyboard device. + /// + /// The index of the keyboard device. + /// A structure containing the state of the mouse device. + MouseState GetState(int index); } } diff --git a/Source/OpenTK/Input/InputDriver.cs b/Source/OpenTK/Input/InputDriver.cs index 3c3cf5a5..4a137c99 100644 --- a/Source/OpenTK/Input/InputDriver.cs +++ b/Source/OpenTK/Input/InputDriver.cs @@ -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 --- diff --git a/Source/OpenTK/Input/Mouse.cs b/Source/OpenTK/Input/Mouse.cs index f94aa3c9..faecb812 100644 --- a/Source/OpenTK/Input/Mouse.cs +++ b/Source/OpenTK/Input/Mouse.cs @@ -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 + /// + /// Retrieves the MouseState for the specified mouse device. + /// + /// A structure containing the state of the mouse device. + public static MouseState GetState() + { + return driver.GetState(); + } + /// /// Retrieves the MouseState for the specified mouse device. /// @@ -59,7 +61,7 @@ namespace OpenTK.Input /// A structure containing the state of the mouse device. public static MouseState GetState(int index) { - throw new NotImplementedException(); + return driver.GetState(index); } #endregion diff --git a/Source/OpenTK/Platform/Factory.cs b/Source/OpenTK/Platform/Factory.cs index 3ac7c3da..b352c714 100644 --- a/Source/OpenTK/Platform/Factory.cs +++ b/Source/OpenTK/Platform/Factory.cs @@ -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 } diff --git a/Source/OpenTK/Platform/IPlatformFactory.cs b/Source/OpenTK/Platform/IPlatformFactory.cs index 8bd81b5a..caae6db1 100644 --- a/Source/OpenTK/Platform/IPlatformFactory.cs +++ b/Source/OpenTK/Platform/IPlatformFactory.cs @@ -48,5 +48,7 @@ namespace OpenTK.Platform IGraphicsMode CreateGraphicsMode(); OpenTK.Input.IKeyboardDriver CreateKeyboardDriver(); + + OpenTK.Input.IMouseDriver CreateMouseDriver(); } } diff --git a/Source/OpenTK/Platform/MacOS/CarbonInput.cs b/Source/OpenTK/Platform/MacOS/CarbonInput.cs index c9c3b997..5355a443 100644 --- a/Source/OpenTK/Platform/MacOS/CarbonInput.cs +++ b/Source/OpenTK/Platform/MacOS/CarbonInput.cs @@ -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 diff --git a/Source/OpenTK/Platform/MacOS/MacOSFactory.cs b/Source/OpenTK/Platform/MacOS/MacOSFactory.cs index 00282dd1..25619903 100644 --- a/Source/OpenTK/Platform/MacOS/MacOSFactory.cs +++ b/Source/OpenTK/Platform/MacOS/MacOSFactory.cs @@ -74,7 +74,12 @@ namespace OpenTK.Platform.MacOS { throw new NotImplementedException(); } - + + public virtual OpenTK.Input.IMouseDriver CreateMouseDriver() + { + throw new NotImplementedException(); + } + #endregion } } diff --git a/Source/OpenTK/Platform/Windows/WMInput.cs b/Source/OpenTK/Platform/Windows/WMInput.cs index d62b9af6..90399ebc 100644 --- a/Source/OpenTK/Platform/Windows/WMInput.cs +++ b/Source/OpenTK/Platform/Windows/WMInput.cs @@ -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 diff --git a/Source/OpenTK/Platform/Windows/WinFactory.cs b/Source/OpenTK/Platform/Windows/WinFactory.cs index 461e5be2..30b25b74 100644 --- a/Source/OpenTK/Platform/Windows/WinFactory.cs +++ b/Source/OpenTK/Platform/Windows/WinFactory.cs @@ -80,6 +80,11 @@ namespace OpenTK.Platform.Windows else return new WMInput(null); } + + public virtual OpenTK.Input.IMouseDriver CreateMouseDriver() + { + throw new NotImplementedException(); + } #endregion } diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index cffe637b..50c1c12e 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -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 diff --git a/Source/OpenTK/Platform/Windows/WinRawInput.cs b/Source/OpenTK/Platform/Windows/WinRawInput.cs index 3c3ad291..3cd04ec6 100644 --- a/Source/OpenTK/Platform/Windows/WinRawInput.cs +++ b/Source/OpenTK/Platform/Windows/WinRawInput.cs @@ -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 diff --git a/Source/OpenTK/Platform/Windows/WinRawMouse.cs b/Source/OpenTK/Platform/Windows/WinRawMouse.cs index cfaf2c78..46ab54f4 100644 --- a/Source/OpenTK/Platform/Windows/WinRawMouse.cs +++ b/Source/OpenTK/Platform/Windows/WinRawMouse.cs @@ -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() diff --git a/Source/OpenTK/Platform/X11/X11Factory.cs b/Source/OpenTK/Platform/X11/X11Factory.cs index 16dbaafe..fd9cb473 100644 --- a/Source/OpenTK/Platform/X11/X11Factory.cs +++ b/Source/OpenTK/Platform/X11/X11Factory.cs @@ -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 } } diff --git a/Source/OpenTK/Platform/X11/X11Input.cs b/Source/OpenTK/Platform/X11/X11Input.cs index b34e0601..3d77cd99 100644 --- a/Source/OpenTK/Platform/X11/X11Input.cs +++ b/Source/OpenTK/Platform/X11/X11Input.cs @@ -238,6 +238,16 @@ namespace OpenTK.Platform.X11 get { return (IList)dummy_mice_list; } //return mouseDriver.Mouse; } + MouseState IMouseDriver.GetState() + { + throw new NotImplementedException(); + } + + MouseState IMouseDriver.GetState(int index) + { + throw new NotImplementedException(); + } + #endregion #region public IList Joysticks