Show FPS in title bar only when 'Display Framerate' is enabled

This commit is contained in:
twinaphex 2016-05-09 07:44:13 +02:00
parent b72f7001de
commit c82505ed9e

View File

@ -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;
}