diff --git a/src/Game.cs b/src/Game.cs index 0b9ea9f2..b8d3b5e7 100644 --- a/src/Game.cs +++ b/src/Game.cs @@ -197,7 +197,7 @@ namespace MoonWorks break; case SDL.SDL_EventType.SDL_MOUSEWHEEL: - Inputs.Mouse.Wheel += _event.wheel.y; + Inputs.Mouse.WheelRaw += _event.wheel.y; break; case SDL.SDL_EventType.SDL_DROPBEGIN: diff --git a/src/Input/Input.cs b/src/Input/Input.cs index 44029240..a48c08ce 100644 --- a/src/Input/Input.cs +++ b/src/Input/Input.cs @@ -37,7 +37,6 @@ namespace MoonWorks.Input AnyPressed = false; AnyPressedButton = default; // DeviceKind.None - Mouse.Wheel = 0; Keyboard.Update(); if (Keyboard.AnyPressed) diff --git a/src/Input/Mouse.cs b/src/Input/Mouse.cs index 3ee65bc9..932ca2a2 100644 --- a/src/Input/Mouse.cs +++ b/src/Input/Mouse.cs @@ -14,7 +14,10 @@ namespace MoonWorks.Input public int DeltaX { 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 MouseButton AnyPressedButton { get; private set; } @@ -74,6 +77,9 @@ namespace MoonWorks.Input DeltaX = deltaX; DeltaY = deltaY; + Wheel = WheelRaw - previousWheelRaw; + previousWheelRaw = WheelRaw; + LeftButton.Update(); MiddleButton.Update(); RightButton.Update();