| 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 | { |
nothing calls this directly
no test coverage detected