diff --git a/src/SlatedGameToolkit.Framework/Graphics/OpenGL/GLFunctionDelegates.cs b/src/SlatedGameToolkit.Framework/Graphics/OpenGL/GLFunctionDelegates.cs index 8175ee6..0f9c76b 100644 --- a/src/SlatedGameToolkit.Framework/Graphics/OpenGL/GLFunctionDelegates.cs +++ b/src/SlatedGameToolkit.Framework/Graphics/OpenGL/GLFunctionDelegates.cs @@ -10,5 +10,8 @@ namespace SlatedGameToolkit.Framework.Graphics.OpenGL internal delegate void GLCompileShader(IntPtr shaderHandle); internal delegate void GLGetShaderLogInfo(IntPtr shaderHandle, int maxLength, out int writtenLength, out string output); internal delegate IntPtr GLCreateProgram(); + internal delegate IntPtr GLDeleteProgram(); internal delegate void GLAttachShader(IntPtr program, IntPtr shader); + internal delegate void GLDetachShader(IntPtr program, IntPtr shader); + internal delegate void GLDeleteShader(IntPtr shader); } \ No newline at end of file diff --git a/src/SlatedGameToolkit.Framework/StateSystem/Manager.cs b/src/SlatedGameToolkit.Framework/StateSystem/Manager.cs index e479279..606cccd 100644 --- a/src/SlatedGameToolkit.Framework/StateSystem/Manager.cs +++ b/src/SlatedGameToolkit.Framework/StateSystem/Manager.cs @@ -111,7 +111,7 @@ namespace SlatedGameToolkit.Framework.StateSystem if (states[name] == currentState) return false; IState state = states[name]; GameEngine.Logger.Debug("Removing state: " + name); - state.Dispose(); + state.Deinitialize(); return states.Remove(name); } diff --git a/src/SlatedGameToolkit.Framework/StateSystem/States/IState.cs b/src/SlatedGameToolkit.Framework/StateSystem/States/IState.cs index 2744be5..1cdc29b 100644 --- a/src/SlatedGameToolkit.Framework/StateSystem/States/IState.cs +++ b/src/SlatedGameToolkit.Framework/StateSystem/States/IState.cs @@ -3,7 +3,7 @@ using SlatedGameToolkit.Framework.Graphics.Window; namespace SlatedGameToolkit.Framework.StateSystem.States { - public interface IState : IDisposable + public interface IState { WindowHandle CurrentWindow { get; } @@ -55,5 +55,11 @@ namespace SlatedGameToolkit.Framework.StateSystem.States /// /// A string representing the name of this state. string getName(); + + /// + /// Called when this state is being removed from the manager, and likely not used again in this games life cycle. + /// Any unmanaged resources that needs to be disposed of should be done so here. + /// + void Deinitialize(); } } \ No newline at end of file diff --git a/src/SlatedGameToolkit.Tools/Utilities/GraphicalPlayground/MainState.cs b/src/SlatedGameToolkit.Tools/Utilities/GraphicalPlayground/MainState.cs index 9b02a5d..bca2537 100644 --- a/src/SlatedGameToolkit.Tools/Utilities/GraphicalPlayground/MainState.cs +++ b/src/SlatedGameToolkit.Tools/Utilities/GraphicalPlayground/MainState.cs @@ -22,7 +22,7 @@ namespace SlatedGameToolkit.Tools.Utilities.GraphicalPlayground return true; } - public void Dispose() + public void Deinitialize() { window.Dispose(); }