1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Hook up save / load trace achievements.

This commit is contained in:
Bartosz Taudul 2024-06-07 23:20:14 +02:00
parent d474f21576
commit 139dc44a00
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 27 additions and 1 deletions

View File

@ -6,6 +6,29 @@
namespace tracy::data namespace tracy::data
{ {
AchievementItem ai_loadTrace = { "loadTrace", "Load a trace", [](const ctx&){
ImGui::TextWrapped( "You can open a previously saved trace file (or one received from a friend) with the '" ICON_FA_FOLDER_OPEN " Open saved trace' button on the welcome screen." );
} };
AchievementItem ai_saveTrace = { "saveTrace", "Save a trace", [](const ctx&){
ImGui::TextWrapped( "Now that you have traced your application (or are in the process of doing so), you can save it to disk for future reference. You can do this by clicking on the " ICON_FA_WIFI " icon in the top left corner of the screen and then clicking on the '" ICON_FA_FLOPPY_DISK " Save trace' button." );
ImGui::TextWrapped( "Keeping old traces on hand can be beneficial, as you can compare the performance of your optimizations with what you had before." );
ImGui::TextWrapped( "You can also share the trace with your friends or co-workers by sending them the trace file." );
ImGui::Spacing();
tracy::TextColoredUnformatted( 0xFF44FFFF, ICON_FA_TRIANGLE_EXCLAMATION );
ImGui::SameLine();
ImGui::TextUnformatted( "Warning" );
ImGui::SameLine();
tracy::TextColoredUnformatted( 0xFF44FFFF, ICON_FA_TRIANGLE_EXCLAMATION );
ImGui::TextWrapped( "Trace files can contain sensitive information about your application, such as program code, or even the contents of source files. Be careful when sharing them with others." );
} };
AchievementItem* ac_connectToServerItems[] = {
&ai_saveTrace,
&ai_loadTrace,
nullptr
};
AchievementItem ai_connectToServer = { "connectToClient", "First profiling session", [](const ctx&){ AchievementItem ai_connectToServer = { "connectToClient", "First profiling session", [](const ctx&){
ImGui::TextWrapped( "Let's start our adventure by instrumenting your application and connecting it to the profiler. Here's a quick refresher:" ); ImGui::TextWrapped( "Let's start our adventure by instrumenting your application and connecting it to the profiler. Here's a quick refresher:" );
ImGui::TextWrapped( " 1. Integrate Tracy Profiler into your application. This can be done using CMake, Meson, or simply by adding the source files to your project." ); ImGui::TextWrapped( " 1. Integrate Tracy Profiler into your application. This can be done using CMake, Meson, or simply by adding the source files to your project." );
@ -17,7 +40,7 @@ AchievementItem ai_connectToServer = { "connectToClient", "First profiling sessi
{ {
tracy::OpenWebpage( "https://github.com/wolfpld/tracy/releases" ); tracy::OpenWebpage( "https://github.com/wolfpld/tracy/releases" );
} }
} }; }, ac_connectToServerItems };
AchievementItem* ac_achievementsIntroItems[] = { AchievementItem* ac_achievementsIntroItems[] = {
&ai_connectToServer, &ai_connectToServer,

View File

@ -98,6 +98,8 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true; if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true;
m_vd.frameTarget = config.targetFps; m_vd.frameTarget = config.targetFps;
Achieve( "loadTrace" );
} }
View::~View() View::~View()
@ -609,6 +611,7 @@ bool View::Draw()
saveFailed = !Save( fn, comp, zlvl, buildDict, streams ); saveFailed = !Save( fn, comp, zlvl, buildDict, streams );
m_filenameStaging.clear(); m_filenameStaging.clear();
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
Achieve( "saveTrace" );
} }
ImGui::SameLine(); ImGui::SameLine();
if( ImGui::Button( "Cancel" ) ) if( ImGui::Button( "Cancel" ) )