Improved dispose structure.

This commit is contained in:
Harrison Deng 2020-05-27 00:33:26 -05:00
parent a013c476e7
commit 442d357626
2 changed files with 2 additions and 14 deletions

View File

@ -96,7 +96,7 @@ namespace SlatedGameToolkit.Framework {
timePassedFromLastRender = 0; timePassedFromLastRender = 0;
} }
} }
manager.Dispose(); manager.removeAllStates();
stopped = true; stopped = true;
SDL.SDL_Quit(); SDL.SDL_Quit();
logger.Information("Game engine has stopped."); logger.Information("Game engine has stopped.");

View File

@ -5,7 +5,7 @@ using SlatedGameToolkit.Framework.StateSystem.States;
namespace SlatedGameToolkit.Framework.StateSystem namespace SlatedGameToolkit.Framework.StateSystem
{ {
public sealed class Manager : IDisposable { public sealed class Manager {
public Thread thread; public Thread thread;
private IState currentState; private IState currentState;
private IState nextState; private IState nextState;
@ -114,17 +114,5 @@ namespace SlatedGameToolkit.Framework.StateSystem
removeState(state); removeState(state);
} }
} }
/// <summary>
/// Disposes of this manager.
/// </summary>
public void Dispose()
{
removeAllStates();
}
~Manager() {
Dispose();
}
} }
} }