Added more OpenGL delegates, and restructured game manager.

Largely untested.
This commit is contained in:
Harrison Deng 2020-05-28 10:19:38 -05:00
parent 1a2ef5a109
commit fb9bbdd123
4 changed files with 12 additions and 3 deletions

View File

@ -10,5 +10,8 @@ namespace SlatedGameToolkit.Framework.Graphics.OpenGL
internal delegate void GLCompileShader(IntPtr shaderHandle); internal delegate void GLCompileShader(IntPtr shaderHandle);
internal delegate void GLGetShaderLogInfo(IntPtr shaderHandle, int maxLength, out int writtenLength, out string output); internal delegate void GLGetShaderLogInfo(IntPtr shaderHandle, int maxLength, out int writtenLength, out string output);
internal delegate IntPtr GLCreateProgram(); internal delegate IntPtr GLCreateProgram();
internal delegate IntPtr GLDeleteProgram();
internal delegate void GLAttachShader(IntPtr program, IntPtr shader); internal delegate void GLAttachShader(IntPtr program, IntPtr shader);
internal delegate void GLDetachShader(IntPtr program, IntPtr shader);
internal delegate void GLDeleteShader(IntPtr shader);
} }

View File

@ -111,7 +111,7 @@ namespace SlatedGameToolkit.Framework.StateSystem
if (states[name] == currentState) return false; if (states[name] == currentState) return false;
IState state = states[name]; IState state = states[name];
GameEngine.Logger.Debug("Removing state: " + name); GameEngine.Logger.Debug("Removing state: " + name);
state.Dispose(); state.Deinitialize();
return states.Remove(name); return states.Remove(name);
} }

View File

@ -3,7 +3,7 @@ using SlatedGameToolkit.Framework.Graphics.Window;
namespace SlatedGameToolkit.Framework.StateSystem.States namespace SlatedGameToolkit.Framework.StateSystem.States
{ {
public interface IState : IDisposable public interface IState
{ {
WindowHandle CurrentWindow { get; } WindowHandle CurrentWindow { get; }
@ -55,5 +55,11 @@ namespace SlatedGameToolkit.Framework.StateSystem.States
/// </summary> /// </summary>
/// <return>A string representing the name of this state.</return> /// <return>A string representing the name of this state.</return>
string getName(); string getName();
/// <summary>
/// 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.
/// </summary>
void Deinitialize();
} }
} }

View File

@ -22,7 +22,7 @@ namespace SlatedGameToolkit.Tools.Utilities.GraphicalPlayground
return true; return true;
} }
public void Dispose() public void Deinitialize()
{ {
window.Dispose(); window.Dispose();
} }