public override void RunLoop()
{
ResetWindowBounds();
while (true)
{
_view.ProcessEvents();
// Stop the main loop iff Game.Exit() has been called.
// This can happen under the following circumstances:
// 1. Game.Exit() is called programmatically.
// 2. The GameWindow is closed through the 'X' (close) button
// 3. The GameWindow is closed through Alt-F4 or Cmd-Q
// Note: once Game.Exit() is called, we must stop raising
// Update or Draw events as the GameWindow and/or OpenGL context
// may no longer be available.
// Note 2: Game.Exit() can be called asynchronously from
// _view.ProcessEvents() (cases #2 and #3 above), so the
// isExiting check must be placed *after* _view.ProcessEvents()
if (isExiting > 0)
{
break;
}
Game.Tick();
}
}