void PhoenixEngine::ChangeState() { if(m_QueuedState == m_LoadingState) { m_CurrentState = m_LoadingState; return; } if(m_QueuedState != nullptr) { if(m_CurrentState != nullptr) { delete m_CurrentState; m_CurrentState = nullptr; } GameState* TemporaryState = m_QueuedState; ToggleLoading(true); TemporaryState->Init(); ToggleLoading(false); m_CurrentState = TemporaryState; Util::msgNote(Util::BuildString("State Loaded: %s", typeid(*m_CurrentState).name())); m_QueuedState = nullptr; } }
void Engine::ChangeState() { if(m_QueuedState == m_LoadingState) { m_CurrentState = m_LoadingState; return; } Util::PrintColor("Entering State ", WHITE); Util::PrintColor(Util::BuildString("%s\n", typeid(*m_QueuedState).name()), GREEN); if(m_QueuedState != nullptr) { if(m_CurrentState != nullptr) { delete m_CurrentState; m_CurrentState = nullptr; ImageManager::ClearCache(); } GameState* TemporaryState = m_QueuedState; ToggleLoading(true); TemporaryState->Init(); ToggleLoading(false); m_CurrentState = TemporaryState; m_QueuedState = nullptr; } }
int main() { bork::Application::Initialize( "RawrRinth", 1024, 576 ); GameState gameState; gameState.Init( &bork::Application::GetWindow() ); bork::StateManager::AddState( "Game", &gameState, true ); gameState.MainLoop(); return 0; }