| 37 | } |
| 38 | |
| 39 | void Game_Quit::Update() { |
| 40 | if (Scene::instance == nullptr || Scene::instance->type == Scene::Title || !Scene::Find(Scene::Title) || !Input::IsPressed(Input::RESET)) { |
| 41 | if (time_left != start_time) { |
| 42 | Reset(); |
| 43 | } |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | window.SetVisible(true); |
| 48 | |
| 49 | if (time_left > 0) { |
| 50 | --time_left; |
| 51 | } |
| 52 | |
| 53 | // FIXME Need to write the text every frame in case system graphic changes.. |
| 54 | auto s = (time_left + DEFAULT_FPS - 1) / DEFAULT_FPS; |
| 55 | window.SetText("Restarting in " + std::to_string(s) + " sec ..."); |
| 56 | window.Update(); |
| 57 | } |
| 58 | |
| 59 | void Game_Quit::OnResolutionChange() { |
| 60 | window.SetX(Player::screen_width / 2 - window_width / 2); |
nothing calls this directly
no test coverage detected