Changeset View
Changeset View
Standalone View
Standalone View
source/main.cpp
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2018 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | #if 0 | ||||
// .. new method - filtered and more smooth, but errors may accumulate | // .. new method - filtered and more smooth, but errors may accumulate | ||||
#else | #else | ||||
const float realTimeSinceLastFrame = 1.0 / g_frequencyFilter->SmoothedFrequency(); | const float realTimeSinceLastFrame = 1.0 / g_frequencyFilter->SmoothedFrequency(); | ||||
#endif | #endif | ||||
ENSURE(realTimeSinceLastFrame > 0.0f); | ENSURE(realTimeSinceLastFrame > 0.0f); | ||||
// decide if update/render is necessary | // decide if update/render is necessary | ||||
bool need_render = !g_app_minimized; | bool need_render = !g_app_minimized && (!g_PauseRendererOnFocusLoss || g_app_has_focus); | ||||
elexis: D1212 changes the same line, we should figure that out before and afterwards we will still have… | |||||
ffffffffAuthorUnsubmitted Not Done Inline Actionstrue should be mergeable ffffffff: true should be mergeable | |||||
bool need_update = true; | bool need_update = true; | ||||
// If we are not running a multiplayer game, disable updates when the game is | // If we are not running a multiplayer game, disable updates when the game is | ||||
// minimized or out of focus and relinquish the CPU a bit, in order to make | // minimized or out of focus and relinquish the CPU a bit, in order to make | ||||
// debugging easier. | // debugging easier. | ||||
if (g_PauseOnFocusLoss && !g_NetClient && !g_app_has_focus) | if (g_PauseGameOnFocusLoss && !g_NetClient && !g_app_has_focus) | ||||
{ | { | ||||
PROFILE3("non-focus delay"); | PROFILE3("non-focus delay"); | ||||
need_update = false; | need_update = false; | ||||
// don't use SDL_WaitEvent: don't want the main loop to freeze until app focus is restored | // don't use SDL_WaitEvent: don't want the main loop to freeze until app focus is restored | ||||
SDL_Delay(10); | SDL_Delay(10); | ||||
} | } | ||||
// this scans for changed files/directories and reloads them, thus | // this scans for changed files/directories and reloads them, thus | ||||
▲ Show 20 Lines • Show All 316 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
D1212 changes the same line, we should figure that out before and afterwards we will still have to test that that solution still works.