Browse Source

add mouse wheel support

main 0.1.0
cosmonaut 1 month ago
parent
commit
681e620477
2 changed files with 8 additions and 0 deletions
  1. +6
    -0
      src/Game.cs
  2. +2
    -0
      src/Input/Mouse.cs

+ 6
- 0
src/Game.cs View File

@ -82,6 +82,8 @@ namespace MoonWorks
{
while (accumulator >= timestep)
{
Inputs.Mouse.Wheel = 0;
HandleSDLEvents();
Inputs.Update();
@ -112,6 +114,10 @@ namespace MoonWorks
case SDL.SDL_EventType.SDL_TEXTINPUT:
HandleTextInput(_event);
break;
case SDL.SDL_EventType.SDL_MOUSEWHEEL:
Inputs.Mouse.Wheel += _event.wheel.y;
break;
}
}
}


+ 2
- 0
src/Input/Mouse.cs View File

@ -13,6 +13,8 @@ namespace MoonWorks.Input
public int DeltaX { get; private set; }
public int DeltaY { get; private set; }
public int Wheel { get; internal set; }
private bool relativeMode;
public bool RelativeMode
{


Loading…
Cancel
Save