Optionally limit the framerate in menus to 50 FPS, to save power. Patch by elexis, fixes #2882
This was SVN commit r16927.
This commit is contained in:
parent
ba82743777
commit
a63e9c521d
@ -319,6 +319,9 @@ move.right = "Ctrl+RightArrow" ; Move cursor to start of word to the right of
|
||||
cursorblinkrate = 0.5 ; Cursor blink rate in seconds (0.0 to disable blinking)
|
||||
scale = 1.0 ; GUI scaling factor, for improved compatibility with 4K displays
|
||||
|
||||
[gui.menu]
|
||||
limitfps = true ; Limit FPS in the menus and loading screen
|
||||
|
||||
[gui.session]
|
||||
attacknotificationmessage = true ; Show attack notification messages
|
||||
camerajump.threshold = 40 ; How close do we have to be to the actual location in order to jump back to the previous one?
|
||||
|
@ -14,7 +14,7 @@ var options = {
|
||||
[translate("Realtime Overlay"), translate("Show current system time in top right corner."), {"config":"overlay.realtime"}, "boolean"],
|
||||
[translate("Gametime Overlay"), translate("Show current simulation time in top right corner."), {"config":"gui.session.timeelapsedcounter"}, "boolean"],
|
||||
[translate("Ceasefire Time Overlay"), translate("Always show the remaining ceasefire time."), {"config":"gui.session.ceasefirecounter"}, "boolean"],
|
||||
[translate("Persist match settings"), translate("Save and restore match settings for quick reuse when hosting another game"), {"config":"persistmatchsettings"}, "boolean"],
|
||||
[translate("Persist Match Settings"), translate("Save and restore match settings for quick reuse when hosting another game"), {"config":"persistmatchsettings"}, "boolean"],
|
||||
],
|
||||
"graphicsSetting":
|
||||
[
|
||||
@ -33,6 +33,7 @@ var options = {
|
||||
[translate("Water Refraction"), translate("Use a real water refraction map and not transparency"), {"renderer":"WaterRefraction", "config":"waterrefraction"}, "boolean"],
|
||||
[translate("Shadows on Water"), translate("Cast shadows on water"), {"renderer":"WaterShadows", "config":"watershadows"}, "boolean"],
|
||||
[translate("VSync"), translate("Run vertical sync to fix screen tearing. REQUIRES GAME RESTART"), {"config":"vsync"}, "boolean"],
|
||||
[translate("Limit FPS in Menus"), translate("Limit FPS to 50 in all menus, to save power."), {"config":"gui.menu.limitfps"}, "boolean"],
|
||||
],
|
||||
"soundSetting":
|
||||
[
|
||||
|
@ -43,6 +43,7 @@ that of Atlas depending on commandline parameters.
|
||||
#include "ps/ArchiveBuilder.h"
|
||||
#include "ps/CConsole.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/Globals.h"
|
||||
@ -300,9 +301,20 @@ static void Frame()
|
||||
SDL_Delay(10);
|
||||
}
|
||||
|
||||
// TODO: throttling: limit update and render frequency to the minimum.
|
||||
// this is mostly relevant for "inactive" state, so that other windows
|
||||
// get enough CPU time, but it's always nice for power+thermal management.
|
||||
// Throttling: limit update and render frequency to the minimum to 50 FPS
|
||||
// in the "inactive" state, so that other windows get enough CPU time,
|
||||
// (and it's always nice for power+thermal management).
|
||||
// TODO: when the game performance is high enough, implementing a limit for
|
||||
// in-game framerate might be sensible.
|
||||
const float maxFPSMenu = 50.0;
|
||||
bool limit_fps = false;
|
||||
CFG_GET_VAL("gui.menu.limitfps", limit_fps);
|
||||
if (limit_fps && (!g_Game || !g_Game->IsGameStarted()))
|
||||
{
|
||||
float remainingFrameTime = (1000.0 / maxFPSMenu) - realTimeSinceLastFrame;
|
||||
if (remainingFrameTime > 0)
|
||||
SDL_Delay(remainingFrameTime);
|
||||
}
|
||||
|
||||
|
||||
// this scans for changed files/directories and reloads them, thus
|
||||
|
Loading…
Reference in New Issue
Block a user