Improved mouse delta handling. WheelDelta is broken.
This commit is contained in:
parent
aea2f77892
commit
d3da5a219a
1 changed files with 9 additions and 12 deletions
|
@ -187,28 +187,26 @@ namespace OpenTK.Platform.Windows
|
||||||
if ((rin.Data.Mouse.ButtonFlags & RawInputMouseState.BUTTON_5_DOWN) != 0) mouse[MouseButton.Button2] = true;
|
if ((rin.Data.Mouse.ButtonFlags & RawInputMouseState.BUTTON_5_DOWN) != 0) mouse[MouseButton.Button2] = true;
|
||||||
if ((rin.Data.Mouse.ButtonFlags & RawInputMouseState.BUTTON_5_UP) != 0) mouse[MouseButton.Button2] = false;
|
if ((rin.Data.Mouse.ButtonFlags & RawInputMouseState.BUTTON_5_UP) != 0) mouse[MouseButton.Button2] = false;
|
||||||
|
|
||||||
|
|
||||||
if (rin.Data.Mouse.ButtonFlags == RawInputMouseState.WHEEL)
|
if (rin.Data.Mouse.ButtonFlags == RawInputMouseState.WHEEL)
|
||||||
{
|
{
|
||||||
//mouse.WheelDelta = rin.Data.Mouse.ButtonData;
|
mouse.Wheel += rin.Data.Mouse.ButtonData / 120;
|
||||||
//mouse.Wheel += rin.Data.Mouse.ButtonData;
|
|
||||||
mouse.WheelDelta = rin.Data.Mouse.ButtonData > 0 ? 1 : -1;
|
|
||||||
mouse.Wheel += mouse.WheelDelta;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rin.Data.Mouse.Flags == RawMouseFlags.MOUSE_MOVE_ABSOLUTE)
|
if (rin.Data.Mouse.Flags == RawMouseFlags.MOUSE_MOVE_ABSOLUTE)
|
||||||
{
|
{
|
||||||
mouse.XDelta = rin.Data.Mouse.LastX - mouse.X;
|
//mouse.XDelta = rin.Data.Mouse.LastX - mouse.X;
|
||||||
mouse.YDelta = rin.Data.Mouse.LastY - mouse.Y;
|
//mouse.YDelta = rin.Data.Mouse.LastY - mouse.Y;
|
||||||
mouse.X = rin.Data.Mouse.LastX;
|
mouse.X = rin.Data.Mouse.LastX;
|
||||||
mouse.Y = rin.Data.Mouse.LastY;
|
mouse.Y = rin.Data.Mouse.LastY;
|
||||||
}
|
}
|
||||||
else if (rin.Data.Mouse.Flags == RawMouseFlags.MOUSE_MOVE_RELATIVE)
|
else if (rin.Data.Mouse.Flags == RawMouseFlags.MOUSE_MOVE_RELATIVE)
|
||||||
{
|
{
|
||||||
mouse.XDelta = rin.Data.Mouse.LastX;
|
//mouse.XDelta = rin.Data.Mouse.LastX;
|
||||||
mouse.YDelta = rin.Data.Mouse.LastY;
|
//mouse.YDelta = rin.Data.Mouse.LastY;
|
||||||
mouse.X += mouse.XDelta;
|
//mouse.X += mouse.XDelta;
|
||||||
mouse.Y += mouse.YDelta;
|
//mouse.Y += mouse.YDelta;
|
||||||
|
mouse.X += rin.Data.Mouse.LastX;
|
||||||
|
mouse.Y += rin.Data.Mouse.LastY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -224,7 +222,6 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public void Poll()
|
public void Poll()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue