MCPcopy Create free account
hub / github.com/antopilo/Nuake / EnterPlayMode

Method EnterPlayMode

Nuake/Source/Engine.cpp:177–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175 }
176
177 void Engine::EnterPlayMode()
178 {
179 lastFrameTime = (float)glfwGetTime(); // Reset timestep timer.
180
181 // Dont trigger init if already in player mode.
182 if (GetGameState() == GameState::Playing || GetGameState() == GameState::Loading)
183 {
184 Logger::Log("Cannot enter play mode if is already in play mode or is loading.", "engine", WARNING);
185 return;
186 }
187
188 SetGameState(GameState::Loading);
189
190 PhysicsManager::Get().ReInit();
191
192 if (GetCurrentScene()->OnInit())
193 {
194 SetGameState(GameState::Playing);
195 }
196 else
197 {
198 Logger::Log("Cannot enter play mode. Scene OnInit failed", "engine", CRITICAL);
199 GetCurrentScene()->OnExit();
200 }
201 }
202
203 void Engine::ExitPlayMode()
204 {

Callers

nothing calls this directly

Calls 5

LogFunction · 0.85
SetGameStateClass · 0.85
OnExitMethod · 0.80
ReInitMethod · 0.45
OnInitMethod · 0.45

Tested by

no test coverage detected