diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index f020ee54..f8b1a6b3 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -102,6 +102,21 @@ namespace tracy draw->AddText( pos, color, text ); } + static void SetButtonHighlightColor() + { + ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor::HSV( 0.35f, 0.6f, 0.6f ) ); + ImGui::PushStyleColor( ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV( 0.35f, 0.8f, 0.8f ) ); + ImGui::PushStyleColor( ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV( 0.35f, 0.7f, 0.7f ) ); + } + + static void ToggleButton( const char* label, bool& toggle ) + { + const auto active = toggle; + if( active ) SetButtonHighlightColor(); + if( ImGui::Button( label ) ) toggle = !toggle; + if( active ) ImGui::PopStyleColor( 3 ); + } + } #endif diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 834d3d19..84d3bfd7 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -73,21 +73,6 @@ static const char* s_tracyStackFrames[] = { }; -static void SetButtonHighlightColor() -{ - ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor::HSV( 0.35f, 0.6f, 0.6f ) ); - ImGui::PushStyleColor( ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV( 0.35f, 0.8f, 0.8f ) ); - ImGui::PushStyleColor( ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV( 0.35f, 0.7f, 0.7f ) ); -} - -static void ToggleButton( const char* label, bool& toggle ) -{ - const auto active = toggle; - if( active ) SetButtonHighlightColor(); - if( ImGui::Button( label ) ) toggle = !toggle; - if( active ) ImGui::PopStyleColor( 3 ); -} - static inline uint64_t GetThreadBit( uint8_t thread ) { return uint64_t( 1 ) << thread;