From c82505ed9eb4a686164de18fcf6769b32f4de415 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 9 May 2016 07:44:13 +0200 Subject: [PATCH] Show FPS in title bar only when 'Display Framerate' is enabled --- gfx/video_driver.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 70ca893c41..8b1492f762 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -998,12 +998,29 @@ bool video_monitor_get_fps(char *buf, size_t size, if ((video_driver_frame_count % FPS_UPDATE_INTERVAL) == 0) { + char frames_text[64]; + settings_t *settings = config_get_ptr(); + last_fps = TIME_TO_FPS(curr_time, new_time, FPS_UPDATE_INTERVAL); curr_time = new_time; - snprintf(buf, size, "%s || FPS: %6.1f || Frames: " U64_SIGN, - video_driver_title_buf, last_fps, + strlcpy(buf, video_driver_title_buf, size); + strlcat(buf, " || ", size); + + if (settings->fps_show) + { + char fps_text[64]; + snprintf(fps_text, sizeof(fps_text), " FPS: %6.1f", last_fps); + strlcat(buf, fps_text, size); + strlcat(buf, " || ", size); + } + + strlcat(buf, "Frames: ", size); + + snprintf(frames_text, sizeof(frames_text), U64_SIGN, (unsigned long long)video_driver_frame_count); + + strlcat(buf, frames_text, size); ret = true; }