Add "displayFPS" config option

This commit is contained in:
Splendide Imaginarius 2022-12-12 05:11:31 +00:00
parent 748aff99cc
commit 23451fb6c0
4 changed files with 14 additions and 4 deletions

View file

@ -34,6 +34,13 @@
// "rgssVersion": 1,
// Continuously display average FPS in window title.
// This can always be toggled with F2 at runtime.
// (default: disabled)
//
// "displayFPS": false,
// Continuously print average FPS to console.
// This setting does not affect the window title
// FPS display toggled via F2

View file

@ -129,6 +129,7 @@ void Config::read(int argc, char *argv[]) {
auto optsJ = json::object({
{"rgssVersion", 0},
{"debugMode", false},
{"displayFPS", false},
{"printFPS", false},
{"winResizable", true},
{"fullscreen", false},
@ -250,6 +251,7 @@ try { exp } catch (...) {}
// now RESUME
SET_OPT(debugMode, boolean);
SET_OPT(displayFPS, boolean);
SET_OPT(printFPS, boolean);
SET_OPT(fullscreen, boolean);
SET_OPT(fixedAspectRatio, boolean);

View file

@ -37,6 +37,7 @@ struct Config {
bool debugMode;
bool winConsole;
bool preferMetalRenderer;
bool displayFPS;
bool printFPS;
bool winResizable;

View file

@ -152,11 +152,11 @@ void EventThread::process(RGSSThreadData &rtData)
fullscreen = rtData.config.fullscreen;
int toggleFSMod = rtData.config.anyAltToggleFS ? KMOD_ALT : KMOD_LALT;
if (rtData.config.printFPS)
bool displayingFPS = rtData.config.displayFPS;
if (displayingFPS || rtData.config.printFPS)
fps.sendUpdates.set();
bool displayingFPS = false;
bool cursorInWindow = false;
/* Will be updated eventually */
SDL_Rect gameScreen = { 0, 0, 0, 0 };