Skip to content

Commit

Permalink
Add frame count
Browse files Browse the repository at this point in the history
  • Loading branch information
jackun committed Mar 15, 2022
1 parent d4064bf commit cd36c59
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/hud_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,14 @@ void HudElements::gamepad_battery()
#endif
}

void HudElements::framecount(){
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_framecount]){
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(std::min(2, ImGui::TableGetColumnCount() - 1)); // give extra room
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%llu", HUDElements.sw_stats->n_frames);
}
}

void HudElements::graphs(){
ImGui::TableNextRow(); ImGui::TableNextColumn();
ImGui::Dummy(ImVec2(0.0f, real_font_size.y));
Expand Down Expand Up @@ -1066,6 +1074,7 @@ void HudElements::sort_elements(const std::pair<std::string, std::string>& optio
if (param == "fsr") { ordered_functions.push_back({gamescope_fsr, value}); }
if (param == "debug") { ordered_functions.push_back({gamescope_frame_timing, value}); }
if (param == "gamepad_battery") { ordered_functions.push_back({gamepad_battery, value}); }
if (param == "framecount") { ordered_functions.push_back({framecount, value}); }
if (param == "graphs"){
if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs])
HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs] = true;
Expand All @@ -1083,7 +1092,7 @@ void HudElements::sort_elements(const std::pair<std::string, std::string>& optio
}

void HudElements::legacy_elements(){
string value = "NULL";
const string value = "NULL";
ordered_functions.clear();
ordered_functions.push_back({time, value});
ordered_functions.push_back({version, value});
Expand All @@ -1109,6 +1118,7 @@ void HudElements::legacy_elements(){
ordered_functions.push_back({wine, value});
#endif
ordered_functions.push_back({frame_timing, value});
ordered_functions.push_back({framecount, value});
ordered_functions.push_back({gamescope_frame_timing, value});
#ifndef MANGOAPP
ordered_functions.push_back({gamemode, value});
Expand Down
1 change: 1 addition & 0 deletions src/hud_elements.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class HudElements{
static void gamescope_fsr();
static void gamescope_frame_timing();
static void gamepad_battery();
static void framecount();

void convert_colors(struct overlay_params& params);
void convert_colors(bool do_conv, struct overlay_params& params);
Expand Down
1 change: 1 addition & 0 deletions src/overlay_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_BOOL(legacy_layout) \
OVERLAY_PARAM_BOOL(cpu_mhz) \
OVERLAY_PARAM_BOOL(frametime) \
OVERLAY_PARAM_BOOL(framecount) \
OVERLAY_PARAM_BOOL(resolution) \
OVERLAY_PARAM_BOOL(show_fps_limit) \
OVERLAY_PARAM_BOOL(fps_color_change) \
Expand Down

0 comments on commit cd36c59

Please sign in to comment.