Fixed threading bug and rewrote syntax of addState

This commit is contained in:
grayson committed 2021-08-19 11:25:03 -05:00
1 parent a21c24040d
commit 9bfbfb637b
3 files changed
+6 -3

No files matched your search

+4 -1
View File
@@ -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() {
+1 -1
View File
@@ -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();