mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Move ToggleButton() out of TracyView.cpp.
This commit is contained in:
parent
5ad1023088
commit
d99129f0e4
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user