mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 13:16:51 +00:00
[Input] MouseState position is now stored in floating point
Several platforms provide subpixel accuracy for mouse position. OpenTK can now take advantage of that.
This commit is contained in:
parent
c81833a201
commit
340d34b07b
|
@ -38,7 +38,8 @@ namespace OpenTK.Input
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
int x, y;
|
internal const int MaxButtons = 16; // we are storing in an ushort
|
||||||
|
Vector2 position;
|
||||||
MouseScroll scroll;
|
MouseScroll scroll;
|
||||||
ushort buttons;
|
ushort buttons;
|
||||||
bool is_connected;
|
bool is_connected;
|
||||||
|
@ -101,7 +102,7 @@ namespace OpenTK.Input
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a <see cref="OpenTK.Input.MouseScrollWheel"/> instance,
|
/// Gets a <see cref="OpenTK.Input.MouseScroll"/> instance,
|
||||||
/// representing the current state of the mouse scroll wheel.
|
/// representing the current state of the mouse scroll wheel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MouseScroll Scroll
|
public MouseScroll Scroll
|
||||||
|
@ -114,8 +115,8 @@ namespace OpenTK.Input
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int X
|
public int X
|
||||||
{
|
{
|
||||||
get { return x; }
|
get { return (int)Math.Round(position.X); }
|
||||||
internal set { x = value; }
|
internal set { position.X = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -123,8 +124,8 @@ namespace OpenTK.Input
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Y
|
public int Y
|
||||||
{
|
{
|
||||||
get { return y; }
|
get { return (int)Math.Round(position.Y); }
|
||||||
internal set { y = value; }
|
internal set { position.Y = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -272,6 +273,12 @@ namespace OpenTK.Input
|
||||||
|
|
||||||
#region Internal Members
|
#region Internal Members
|
||||||
|
|
||||||
|
internal Vector2 Position
|
||||||
|
{
|
||||||
|
get { return position; }
|
||||||
|
set { position = value; }
|
||||||
|
}
|
||||||
|
|
||||||
internal bool ReadBit(int offset)
|
internal bool ReadBit(int offset)
|
||||||
{
|
{
|
||||||
ValidateOffset(offset);
|
ValidateOffset(offset);
|
||||||
|
|
Loading…
Reference in a new issue