diff --git a/Game/src/Game.cpp b/Game/src/Game.cpp index 34fb7ea..29554ef 100644 --- a/Game/src/Game.cpp +++ b/Game/src/Game.cpp @@ -10,7 +10,7 @@ int main(int argc, char* argv[]) { // app.setWindowCursor(...); MainState* test = new MainState; - app.addState("Main State", test); + app.addState(test, "Main State"); app.addDefaultState("Main State"); app.run(); diff --git a/NothinFancy/src/Application.cpp b/NothinFancy/src/Application.cpp index b59469d..f2f28fa 100644 --- a/NothinFancy/src/Application.cpp +++ b/NothinFancy/src/Application.cpp @@ -34,7 +34,7 @@ namespace nf { SetClassLongPtr(m_window, GCLP_HCURSOR, (LONG_PTR)hCursor); } - void Application::addState(const char* stateName, IGamestate* state) { + void Application::addState(IGamestate* state, const char* stateName) { if (m_states.find(stateName) == m_states.end()) { m_states[stateName] = state; } @@ -142,6 +142,9 @@ namespace nf { m_frameClock = std::chrono::steady_clock::now(); } m_currentState->onExit(); + ReleaseDC(m_window, m_hdc); + wglMakeCurrent(NULL, NULL); + wglDeleteContext(m_hglrc); } void Application::registerWindowClass() { diff --git a/NothinFancy/src/include/Application.h b/NothinFancy/src/include/Application.h index 26a4246..d337a80 100644 --- a/NothinFancy/src/include/Application.h +++ b/NothinFancy/src/include/Application.h @@ -17,7 +17,7 @@ namespace nf { void setWindowIcon(HANDLE hIcon); void setWindowCursor(HCURSOR hCursor); - void addState(const char* stateName, IGamestate* state); + void addState(IGamestate* state, const char* stateName); void addDefaultState(const char* stateName); void changeState(const char* stateName); void run();