fix Mouse.Wheel calculation

moar-validation
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;
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:

View File

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

View File

@ -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();