Skip to content

Commit

Permalink
Show FPS in title bar only when 'Display Framerate' is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed May 9, 2016
1 parent b72f700 commit c82505e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions gfx/video_driver.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit c82505e

Please sign in to comment.