Merge pull request #177 from thefiddler/gw_input

[Input] Added GameWindow.Mouse/Keyboard.GetState()
This commit is contained in:
thefiddler 2014-09-11 09:33:07 +02:00
commit 05e40b6f09
3 changed files with 65 additions and 2 deletions

View file

@ -596,28 +596,34 @@ namespace OpenTK
#region Keyboard
#pragma warning disable 0612
/// <summary>
/// Gets the primary Keyboard device, or null if no Keyboard exists.
/// </summary>
[Obsolete("Use KeyDown, KeyUp and KeyPress events or OpenTK.Input.Keyboard instead.")]
public KeyboardDevice Keyboard
{
get { return InputDriver.Keyboard.Count > 0 ? InputDriver.Keyboard[0] : null; }
}
#pragma warning restore 0612
#endregion
#region Mouse
#pragma warning disable 0612
/// <summary>
/// Gets the primary Mouse device, or null if no Mouse exists.
/// </summary>
[Obsolete("Use MouseMove, MouseDown, MouseUp and MouseWheel events or OpenTK.Input.Mouse, instead.")]
public MouseDevice Mouse
{
get { return InputDriver.Mouse.Count > 0 ? InputDriver.Mouse[0] : null; }
}
#pragma warning restore 0612
#endregion
#region --- GameWindow Timing ---

View file

@ -161,6 +161,29 @@ namespace OpenTK.Input
#region --- Public Methods ---
/// <summary>
/// Retrieves the combined <see cref="OpenTK.Input.KeyboardState"/> for all keyboard devices.
/// This method is equivalent to <see cref="OpenTK.Input.Keyboard.GetState()"/>.
/// </summary>
/// <returns>An <see cref="OpenTK.Input.KeyboardState"/> structure containing the combined state for all keyboard devices.</returns>
/// <seealso cref="OpenTK.Input.Keyboard.GetState()"/>
public KeyboardState GetState()
{
return Keyboard.GetState();
}
/// <summary>
/// Retrieves the <see cref="OpenTK.Input.KeyboardState"/> for the specified keyboard device.
/// This method is equivalent to <see cref="OpenTK.Input.Keyboard.GetState(int)"/>.
/// </summary>
/// <param name="index">The index of the keyboard device.</param>
/// <returns>An <see cref="OpenTK.Input.KeyboardState"/> structure containing the combined state for all keyboard devices.</returns>
/// <seealso cref="OpenTK.Input.Keyboard.GetState(int)"/>
public KeyboardState GetState(int index)
{
return Keyboard.GetState(index);
}
/// <summary>Returns the hash code for this KeyboardDevice.</summary>
/// <returns>A 32-bit signed integer hash code.</returns>
public override int GetHashCode()

View file

@ -88,6 +88,40 @@ namespace OpenTK.Input
#region --- Public Members ---
/// <summary>
/// Retrieves the combined hardware <see cref="OpenTK.Input.MouseState"/> for all specified mouse devices.
/// This method is equivalent to <see cref="OpenTK.Input.Mouse.GetState()"/>.
/// </summary>
/// <returns>A <see cref="OpenTK.Input.MouseState"/> structure representing the state for the specified mouse device.</returns>
/// <seealso cref="OpenTK.Input.Mouse.GetState()"/>
public MouseState GetState()
{
return Mouse.GetState();
}
/// <summary>
/// Retrieves the hardware <see cref="OpenTK.Input.MouseState"/> for the specified mouse device.
/// This method is equivalent to <see cref="OpenTK.Input.Mouse.GetState(int)"/>.
/// </summary>
/// <param name="index">The index of the mouse device.</param>
/// <returns>A <see cref="OpenTK.Input.MouseState"/> structure representing the state for the specified mouse device.</returns>
/// <seealso cref="OpenTK.Input.Mouse.GetState(int)"/>
public MouseState GetState(int index)
{
return Mouse.GetState(index);
}
/// <summary>
/// Retreves the <see cref="OpenTK.Input.MouseState"/> for the mouse cursor.
/// This method is equivalent to <see cref="OpenTK.Input.Mouse.GetCursorState"/>.
/// </summary>
/// <returns>A <see cref="OpenTK.Input.MouseState"/> structure representing the state of the mouse cursor.</returns>
/// <seealso cref="OpenTK.Input.Mouse.GetCursorState()"/>
public MouseState GetCursorState()
{
return Mouse.GetCursorState();
}
#region public int NumberOfButtons
/// <summary>