Profiler - Fixed checkboxes

This commit is contained in:
Emmanuel BENOîT 2017-12-24 18:54:05 +01:00
parent 786d1cf2fe
commit 9b13b8e1c6

View file

@ -148,7 +148,7 @@ void T_Profiler::makeUI( )
ImGui::SetNextWindowPos( ImVec2( 0 , dspSize.y * .66f ) , ImGuiSetCond_Appearing ); ImGui::SetNextWindowPos( ImVec2( 0 , dspSize.y * .66f ) , ImGuiSetCond_Appearing );
ImGui::Begin( "Profiler" , &uiEnabled_ , ImGuiWindowFlags_NoCollapse ); ImGui::Begin( "Profiler" , &uiEnabled_ , ImGuiWindowFlags_NoCollapse );
ImGui::BeginChild( "left" , ImVec2( 180 , 0 ) , true ); ImGui::BeginChild( "left" , ImVec2( 240 , 0 ) , true );
float angle( 0 ); float angle( 0 );
displayed_.resize( n , true ); displayed_.resize( n , true );
for ( auto i = 0u ; i < n ; i ++ ) { for ( auto i = 0u ; i < n ; i ++ ) {
@ -159,14 +159,13 @@ void T_Profiler::makeUI( )
ImGui::PushStyleColor( ImGuiCol_Text , color ); ImGui::PushStyleColor( ImGuiCol_Text , color );
ebcl::T_StringBuilder sb; ebcl::T_StringBuilder sb;
char tms[ 12 ]; sb << sections_[ i ] << '\0';
snprintf( tms , 12 , "%.1f" , secDurations_[ i ] );
sb << sections_[ i ] << " (" << tms << "ms)" << '\0';
ImGui::Checkbox( sb.data( ) , &displayed_[ i ] ); ImGui::Checkbox( sb.data( ) , &displayed_[ i ] );
ImGui::PopStyleColor( ); ImGui::PopStyleColor( );
if ( ImGui::IsItemHovered( ) ) { if ( ImGui::IsItemHovered( ) ) {
ImGui::BeginTooltip( ); ImGui::BeginTooltip( );
char tms[ 12 ];
snprintf( tms , 12 , "%.3f" , secDurations_[ i ] ); snprintf( tms , 12 , "%.3f" , secDurations_[ i ] );
sb.clear( ) << sections_[ i ] << '\0'; sb.clear( ) << sections_[ i ] << '\0';
ImGui::PushStyleColor( ImGuiCol_Text , color ); ImGui::PushStyleColor( ImGuiCol_Text , color );
@ -182,6 +181,11 @@ void T_Profiler::makeUI( )
ImGui::EndTooltip( ); ImGui::EndTooltip( );
} }
ImGui::PushStyleColor( ImGuiCol_Text , color );
ImGui::SameLine( 180 );
ImGui::Text( "%.3fms" , secDurations_[ i ] );
ImGui::PopStyleColor( );
} }
ImGui::EndChild( ); ImGui::EndChild( );
ImGui::SameLine( ); ImGui::SameLine( );