fix Mouse.Wheel calculation

pull/29/head
cosmonaut 2022-10-21 11:39:06 -07:00
parent ea86212199
commit 59190e619d
3 changed files with 8 additions and 3 deletions

View File

@ -197,7 +197,7 @@ namespace MoonWorks
break; break;
case SDL.SDL_EventType.SDL_MOUSEWHEEL: case SDL.SDL_EventType.SDL_MOUSEWHEEL:
Inputs.Mouse.Wheel += _event.wheel.y; Inputs.Mouse.WheelRaw += _event.wheel.y;
break; break;
case SDL.SDL_EventType.SDL_DROPBEGIN: case SDL.SDL_EventType.SDL_DROPBEGIN:

View File

@ -37,7 +37,6 @@ namespace MoonWorks.Input
AnyPressed = false; AnyPressed = false;
AnyPressedButton = default; // DeviceKind.None AnyPressedButton = default; // DeviceKind.None
Mouse.Wheel = 0;
Keyboard.Update(); Keyboard.Update();
if (Keyboard.AnyPressed) if (Keyboard.AnyPressed)

View File

@ -14,7 +14,10 @@ namespace MoonWorks.Input
public int DeltaX { get; private set; } public int DeltaX { get; private set; }
public int DeltaY { get; private set; } public int DeltaY { get; private set; }
public int Wheel { get; internal set; } // note that this is a delta value
public int Wheel { get; private set; }
internal int WheelRaw;
private int previousWheelRaw = 0;
public bool AnyPressed { get; private set; } public bool AnyPressed { get; private set; }
public MouseButton AnyPressedButton { get; private set; } public MouseButton AnyPressedButton { get; private set; }
@ -74,6 +77,9 @@ namespace MoonWorks.Input
DeltaX = deltaX; DeltaX = deltaX;
DeltaY = deltaY; DeltaY = deltaY;
Wheel = WheelRaw - previousWheelRaw;
previousWheelRaw = WheelRaw;
LeftButton.Update(); LeftButton.Update();
MiddleButton.Update(); MiddleButton.Update();
RightButton.Update(); RightButton.Update();