fix Mouse.Wheel calculation
parent
ea86212199
commit
59190e619d
|
@ -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:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue