Skip to content

Commit

Permalink
FPS counter now appears at the top left corner every time (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaposfos13 authored Oct 21, 2024
1 parent be1d11e commit 406041b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/devtools/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using namespace Core::Devtools;
using L = Core::Devtools::Layer;

static bool show_simple_fps = false;
static bool visibility_toggled = false;

static float fps_scale = 1.0f;
static bool show_advanced_debug = false;
Expand Down Expand Up @@ -296,20 +297,24 @@ void L::Draw() {
const auto fn = DebugState.flip_frame_count.load();
frame_graph.AddFrame(fn, io.DeltaTime);
}

if (IsKeyPressed(ImGuiKey_F10, false)) {
if (io.KeyCtrl) {
show_advanced_debug = !show_advanced_debug;
} else {
show_simple_fps = !show_simple_fps;
}
visibility_toggled = true;
}

if (show_simple_fps) {
if (Begin("Video Info", nullptr,
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration |
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDocking)) {
SetWindowPos("Video Info", {999999.0f, 0.0f}, ImGuiCond_FirstUseEver);
// Set window position to top left if it was toggled on
if (visibility_toggled) {
SetWindowPos("Video Info", {999999.0f, 0.0f}, ImGuiCond_Always);
visibility_toggled = false;
}
if (BeginPopupContextWindow()) {
#define M(label, value) \
if (MenuItem(label, nullptr, fps_scale == value)) \
Expand Down

0 comments on commit 406041b

Please sign in to comment.