Skip to content

Commit 406041b

Browse files
authored
FPS counter now appears at the top left corner every time (#1426)
1 parent be1d11e commit 406041b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/core/devtools/layer.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ using namespace Core::Devtools;
1919
using L = Core::Devtools::Layer;
2020

2121
static bool show_simple_fps = false;
22+
static bool visibility_toggled = false;
2223

2324
static float fps_scale = 1.0f;
2425
static bool show_advanced_debug = false;
@@ -296,20 +297,24 @@ void L::Draw() {
296297
const auto fn = DebugState.flip_frame_count.load();
297298
frame_graph.AddFrame(fn, io.DeltaTime);
298299
}
299-
300300
if (IsKeyPressed(ImGuiKey_F10, false)) {
301301
if (io.KeyCtrl) {
302302
show_advanced_debug = !show_advanced_debug;
303303
} else {
304304
show_simple_fps = !show_simple_fps;
305305
}
306+
visibility_toggled = true;
306307
}
307308

308309
if (show_simple_fps) {
309310
if (Begin("Video Info", nullptr,
310311
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration |
311312
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDocking)) {
312-
SetWindowPos("Video Info", {999999.0f, 0.0f}, ImGuiCond_FirstUseEver);
313+
// Set window position to top left if it was toggled on
314+
if (visibility_toggled) {
315+
SetWindowPos("Video Info", {999999.0f, 0.0f}, ImGuiCond_Always);
316+
visibility_toggled = false;
317+
}
313318
if (BeginPopupContextWindow()) {
314319
#define M(label, value) \
315320
if (MenuItem(label, nullptr, fps_scale == value)) \

0 commit comments

Comments
 (0)