From fb4d76469b403da6a0d99d3d5905a4dc47573bce Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 28 Sep 2022 00:31:42 +0200 Subject: [PATCH] Activity tracking global variable. --- profiler/src/main.cpp | 2 +- server/TracyImGui.cpp | 13 +++++++++++++ server/TracyImGui.hpp | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index b39da8ae..ff422039 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -271,7 +271,7 @@ static void DrawContents() bptr->NewFrame( display_w, display_h ); static int activeFrames = 3; - if( view && view->WasActive() ) + if( tracy::WasActive() || ( view && view->WasActive() ) ) { activeFrames = 3; } diff --git a/server/TracyImGui.cpp b/server/TracyImGui.cpp index ed50398b..f4aaff84 100644 --- a/server/TracyImGui.cpp +++ b/server/TracyImGui.cpp @@ -13,6 +13,19 @@ namespace tracy { +bool s_wasActive = false; + +bool WasActive() +{ + if( s_wasActive ) + { + s_wasActive = false; + return true; + } + return false; +} + + void DrawZigZag( ImDrawList* draw, const ImVec2& wpos, double start, double end, double h, uint32_t color, float thickness ) { const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index a0f218ef..fd3c04d7 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -22,6 +22,10 @@ static inline ImVec2 operator-( const ImVec2& l, const ImVec2& r ) { return ImVe namespace tracy { +extern bool s_wasActive; +bool WasActive(); + + void DrawZigZag( ImDrawList* draw, const ImVec2& wpos, double start, double end, double h, uint32_t color, float thickness = 1.f ); void DrawStripedRect( ImDrawList* draw, const ImVec2& wpos, double x0, double y0, double x1, double y1, double sw, uint32_t color, bool fix_stripes_in_screen_space, bool inverted ); void DrawHistogramMinMaxLabel( ImDrawList* draw, int64_t tmin, int64_t tmax, ImVec2 wpos, float w, float ty );