add method to signal a main loop exit from the game app class

This commit is contained in:
Gered 2013-08-17 18:00:34 -04:00
parent b7af755418
commit 26ed52d390
4 changed files with 10 additions and 0 deletions

View file

@ -163,6 +163,12 @@ namespace Blarg.GameFramework
ReleaseSDL();
}
public override void Quit()
{
Logger.Info(LOG_TAG, "Quit signaled. Main loop will exit.");
_isQuitting = true;
}
private void MainLoop()
{
_isWindowActive = true;

View file

@ -32,6 +32,7 @@ namespace Blarg.GameFramework
public bool IsRunningSlowly { get; protected set; }
public abstract void Run(IGameApp gameApp, IPlatformConfiguration config);
public abstract void Quit();
protected void OnAppGainFocus()
{

View file

@ -27,6 +27,7 @@ namespace Blarg.GameFramework
bool IsRunningSlowly { get; }
void Run(IGameApp gameApp, IPlatformConfiguration config);
void Quit();
}
}

View file

@ -55,6 +55,8 @@ namespace Game
public void OnUpdate(float delta)
{
if (Platform.Keyboard.IsPressed(Blarg.GameFramework.Input.Key.Escape))
Platform.Looper.Quit();
}
public void Dispose()