handle quit

main
cosmonaut 2021-01-19 20:23:09 -08:00
parent 408e438efc
commit adf047955e
1 changed files with 15 additions and 1 deletions

View File

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