Fixed threading bug and rewrote syntax of addState
This commit is contained in:
parent
a21c24040d
commit
9bfbfb637b
@ -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();
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user