Ticket #2882: t2882_limit_fps_v2.patch
File t2882_limit_fps_v2.patch, 4.2 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/options/options.js
12 12 [translate("Detailed Tooltips"), translate("Show detailed tooltips for trainable units in unit-producing buildings."), {"config":"showdetailedtooltips"}, "boolean"], 13 13 [translate("FPS Overlay"), translate("Show frames per second in top right corner."), {"config":"overlay.fps"}, "boolean"], 14 14 [translate("Realtime Overlay"), translate("Show current system time in top right corner."), {"config":"overlay.realtime"}, "boolean"], 15 15 [translate("Gametime Overlay"), translate("Show current simulation time in top right corner."), {"config":"gui.session.timeelapsedcounter"}, "boolean"], 16 16 [translate("Ceasefire Time Overlay"), translate("Always show the remaining ceasefire time."), {"config":"gui.session.ceasefirecounter"}, "boolean"], 17 [translate("Persist match settings"), translate("Save and restore match settings for quick reuse when hosting another game"), {"config":"persistmatchsettings"}, "boolean"],17 [translate("Persist Match Settings"), translate("Save and restore match settings for quick reuse when hosting another game"), {"config":"persistmatchsettings"}, "boolean"], 18 18 ], 19 19 "graphicsSetting": 20 20 [ 21 21 [translate("Prefer GLSL"), translate("Use OpenGL 2.0 shaders (recommended)"), {"renderer":"PreferGLSL", "config":"preferglsl"}, "boolean"], 22 22 [translate("Post Processing"), translate("Use screen-space postprocessing filters (HDR, Bloom, DOF, etc)"), {"renderer":"Postproc", "config":"postproc"}, "boolean"], … … 31 31 [translate("Real Water Depth"), translate("Use actual water depth in rendering calculations"), {"renderer":"WaterRealDepth", "config":"waterrealdepth"}, "boolean"], 32 32 [translate("Water Reflections"), translate("Allow water to reflect a mirror image"), {"renderer":"WaterReflection", "config":"waterreflection"}, "boolean"], 33 33 [translate("Water Refraction"), translate("Use a real water refraction map and not transparency"), {"renderer":"WaterRefraction", "config":"waterrefraction"}, "boolean"], 34 34 [translate("Shadows on Water"), translate("Cast shadows on water"), {"renderer":"WaterShadows", "config":"watershadows"}, "boolean"], 35 35 [translate("VSync"), translate("Run vertical sync to fix screen tearing. REQUIRES GAME RESTART"), {"config":"vsync"}, "boolean"], 36 [translate("Limit FPS in Menus"), translate("Limit frames per second in all menus."), {"config":"limit_fps_menu"}, "boolean"], 36 37 ], 37 38 "soundSetting": 38 39 [ 39 40 [translate("Master Gain"), translate("Master audio gain"), {"config":"sound.mastergain", "function":"Engine.SetMasterGain(Number(this.caption));"}, "number"], 40 41 [translate("Music Gain"), translate("In game music gain"), {"config":"sound.musicgain", "function":"Engine.SetMusicGain(Number(this.caption));"}, "number"], -
source/main.cpp
41 41 #include "lib/external_libraries/libsdl.h" 42 42 43 43 #include "ps/ArchiveBuilder.h" 44 44 #include "ps/CConsole.h" 45 45 #include "ps/CLogger.h" 46 #include "ps/ConfigDB.h" 46 47 #include "ps/Filesystem.h" 47 48 #include "ps/Game.h" 48 49 #include "ps/Globals.h" 49 50 #include "ps/Hotkey.h" 50 51 #include "ps/Loader.h" … … 298 299 need_update = false; 299 300 // don't use SDL_WaitEvent: don't want the main loop to freeze until app focus is restored 300 301 SDL_Delay(10); 301 302 } 302 303 303 // T ODO: throttling: limit update and render frequency to the minimum.304 // Throttling: limit update and render frequency to the minimum. 304 305 // this is mostly relevant for "inactive" state, so that other windows 305 306 // get enough CPU time, but it's always nice for power+thermal management. 307 bool limit_fps_menu = false; 308 CFG_GET_VAL("limit_fps_menu", limit_fps_menu); 309 const float maxFPSMenu = 50.0; 310 if (limit_fps_menu && (!g_Game || !g_Game->IsGameStarted())) 311 SDL_Delay((1000.0 / maxFPSMenu) - realTimeSinceLastFrame); 306 312 307 313 308 314 // this scans for changed files/directories and reloads them, thus 309 315 // allowing hotloading (changes are immediately assimilated in-game). 310 316 ReloadChangedFiles();