forked from MoonsideGames/MoonWorks
handle quit
parent
408e438efc
commit
adf047955e
16
src/Game.cs
16
src/Game.cs
|
@ -79,7 +79,8 @@ namespace MoonWorks
|
|||
{
|
||||
while (accumulator >= timestep)
|
||||
{
|
||||
SDL.SDL_PumpEvents();
|
||||
HandleSDLEvents();
|
||||
|
||||
Input.Update();
|
||||
|
||||
Update(timestep);
|
||||
|
@ -95,6 +96,19 @@ namespace MoonWorks
|
|||
}
|
||||
}
|
||||
|
||||
private void HandleSDLEvents()
|
||||
{
|
||||
while (SDL.SDL_PollEvent(out var _event) == 1)
|
||||
{
|
||||
switch (_event.type)
|
||||
{
|
||||
case SDL.SDL_EventType.SDL_QUIT:
|
||||
quit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void Update(double dt);
|
||||
|
||||
protected abstract void Draw();
|
||||
|
|
Loading…
Reference in New Issue