add method to signal a main loop exit from the game app class
This commit is contained in:
parent
b7af755418
commit
26ed52d390
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace Blarg.GameFramework
|
|||
bool IsRunningSlowly { get; }
|
||||
|
||||
void Run(IGameApp gameApp, IPlatformConfiguration config);
|
||||
void Quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Reference in a new issue