From 1ddd395aadd6b0660c0e5f07740cfed0fc993738 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 23 May 2020 16:49:27 +0200 Subject: [PATCH] Properly setup View, when using command line parameters. --- profiler/src/main.cpp | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index a287bff2..fe3f4ab3 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -131,40 +131,6 @@ static ImGuiTextFilter addrFilter, portFilter, progFilter; int main( int argc, char** argv ) { - if( argc == 2 ) - { - auto f = std::unique_ptr( tracy::FileRead::Open( argv[1] ) ); - if( f ) - { - view = std::make_unique( *f ); - } - } - else - { - while( argc >= 3 ) - { - if( strcmp( argv[1], "-a" ) == 0 ) - { - connectTo = argv[2]; - } - else if( strcmp( argv[1], "-p" ) == 0 ) - { - port = atoi( argv[2] ); - } - else - { - fprintf( stderr, "Bad parameter: %s", argv[1] ); - exit( 1 ); - } - argc -= 2; - argv += 2; - } - } - if( connectTo ) - { - view = std::make_unique( connectTo, port ); - } - sprintf( title, "Tracy Profiler %i.%i.%i", tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch ); std::string winPosFile = tracy::GetSavePath( "window.position" ); @@ -320,6 +286,40 @@ int main( int argc, char** argv ) style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.45f); style.ScaleAllSizes( dpiScale ); + if( argc == 2 ) + { + auto f = std::unique_ptr( tracy::FileRead::Open( argv[1] ) ); + if( f ) + { + view = std::make_unique( *f, fixedWidth, smallFont, bigFont, SetWindowTitleCallback ); + } + } + else + { + while( argc >= 3 ) + { + if( strcmp( argv[1], "-a" ) == 0 ) + { + connectTo = argv[2]; + } + else if( strcmp( argv[1], "-p" ) == 0 ) + { + port = atoi( argv[2] ); + } + else + { + fprintf( stderr, "Bad parameter: %s", argv[1] ); + exit( 1 ); + } + argc -= 2; + argv += 2; + } + } + if( connectTo ) + { + view = std::make_unique( connectTo, port, fixedWidth, smallFont, bigFont, SetWindowTitleCallback ); + } + glfwShowWindow( window ); // Main loop