diff --git a/profiler/build/win32/Tracy.vcxproj b/profiler/build/win32/Tracy.vcxproj
index a9c87363..bd6bf1f4 100644
--- a/profiler/build/win32/Tracy.vcxproj
+++ b/profiler/build/win32/Tracy.vcxproj
@@ -134,6 +134,7 @@
+
@@ -236,6 +237,7 @@
+
diff --git a/profiler/build/win32/Tracy.vcxproj.filters b/profiler/build/win32/Tracy.vcxproj.filters
index ba7354da..173c48ad 100644
--- a/profiler/build/win32/Tracy.vcxproj.filters
+++ b/profiler/build/win32/Tracy.vcxproj.filters
@@ -249,6 +249,9 @@
common
+
+ server
+
@@ -578,6 +581,9 @@
common
+
+ server
+
diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp
index 04353ec7..09fac0e2 100644
--- a/profiler/src/main.cpp
+++ b/profiler/src/main.cpp
@@ -22,11 +22,6 @@
# include "../nfd/nfd.h"
#endif
-#ifdef _WIN32
-# include
-# include
-#endif
-
#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_PNG
#include "stb_image.h"
@@ -43,6 +38,7 @@
#include "../../server/TracyStorage.hpp"
#include "../../server/TracyVersion.hpp"
#include "../../server/TracyView.hpp"
+#include "../../server/TracyWeb.hpp"
#include "../../server/TracyWorker.hpp"
#include "../../server/TracyVersion.hpp"
#include "../../server/IconsFontAwesome5.h"
@@ -61,21 +57,6 @@ static void glfw_error_callback(int error, const char* description)
fprintf(stderr, "Error %d: %s\n", error, description);
}
-static void OpenWebpage( const char* url )
-{
-#ifdef _WIN32
- ShellExecuteA( nullptr, nullptr, url, nullptr, nullptr, 0 );
-#elif defined __APPLE__
- char buf[1024];
- sprintf( buf, "open %s", url );
- system( buf );
-#else
- char buf[1024];
- sprintf( buf, "xdg-open %s", url );
- system( buf );
-#endif
-}
-
GLFWwindow* s_glfwWindow = nullptr;
static bool s_customTitle = false;
static void SetWindowTitleCallback( const char* title )
@@ -619,7 +600,7 @@ static void DrawContents()
ImGui::Spacing();
if( ImGui::Button( ICON_FA_BOOK " Manual" ) )
{
- OpenWebpage( "https://github.com/wolfpld/tracy/releases" );
+ tracy::OpenWebpage( "https://github.com/wolfpld/tracy/releases" );
}
ImGui::SameLine();
if( ImGui::Button( ICON_FA_GLOBE_AMERICAS " Web" ) )
@@ -630,44 +611,44 @@ static void DrawContents()
{
if( ImGui::Selectable( ICON_FA_HOME " Tracy Profiler home page" ) )
{
- OpenWebpage( "https://github.com/wolfpld/tracy" );
+ tracy::OpenWebpage( "https://github.com/wolfpld/tracy" );
}
ImGui::Separator();
if( ImGui::Selectable( ICON_FA_VIDEO " Overview of v0.2" ) )
{
- OpenWebpage( "https://www.youtube.com/watch?v=fB5B46lbapc" );
+ tracy::OpenWebpage( "https://www.youtube.com/watch?v=fB5B46lbapc" );
}
if( ImGui::Selectable( ICON_FA_VIDEO " New features in v0.3" ) )
{
- OpenWebpage( "https://www.youtube.com/watch?v=3SXpDpDh2Uo" );
+ tracy::OpenWebpage( "https://www.youtube.com/watch?v=3SXpDpDh2Uo" );
}
if( ImGui::Selectable( ICON_FA_VIDEO " New features in v0.4" ) )
{
- OpenWebpage( "https://www.youtube.com/watch?v=eAkgkaO8B9o" );
+ tracy::OpenWebpage( "https://www.youtube.com/watch?v=eAkgkaO8B9o" );
}
if( ImGui::Selectable( ICON_FA_VIDEO " New features in v0.5" ) )
{
- OpenWebpage( "https://www.youtube.com/watch?v=P6E7qLMmzTQ" );
+ tracy::OpenWebpage( "https://www.youtube.com/watch?v=P6E7qLMmzTQ" );
}
if( ImGui::Selectable( ICON_FA_VIDEO " New features in v0.6" ) )
{
- OpenWebpage( "https://www.youtube.com/watch?v=uJkrFgriuOo" );
+ tracy::OpenWebpage( "https://www.youtube.com/watch?v=uJkrFgriuOo" );
}
if( ImGui::Selectable( ICON_FA_VIDEO " New features in v0.7" ) )
{
- OpenWebpage( "https://www.youtube.com/watch?v=_hU7vw00MZ4" );
+ tracy::OpenWebpage( "https://www.youtube.com/watch?v=_hU7vw00MZ4" );
}
ImGui::EndPopup();
}
ImGui::SameLine();
if( ImGui::Button( ICON_FA_COMMENT " Chat" ) )
{
- OpenWebpage( "https://discord.gg/pk78auc" );
+ tracy::OpenWebpage( "https://discord.gg/pk78auc" );
}
ImGui::SameLine();
if( ImGui::Button( ICON_FA_HEART " Sponsor" ) )
{
- OpenWebpage( "https://github.com/sponsors/wolfpld/" );
+ tracy::OpenWebpage( "https://github.com/sponsors/wolfpld/" );
}
if( updateVersion != 0 && updateVersion > tracy::FileVersion( tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch ) )
{
@@ -928,7 +909,7 @@ static void DrawContents()
ImGui::Begin( "Update available!", &showReleaseNotes );
if( ImGui::Button( ICON_FA_DOWNLOAD " Download" ) )
{
- OpenWebpage( "https://github.com/wolfpld/tracy/releases" );
+ tracy::OpenWebpage( "https://github.com/wolfpld/tracy/releases" );
}
ImGui::BeginChild( "###notes", ImVec2( 0, 0 ), true );
if( releaseNotes.empty() )
diff --git a/server/TracyWeb.cpp b/server/TracyWeb.cpp
new file mode 100644
index 00000000..523f38ef
--- /dev/null
+++ b/server/TracyWeb.cpp
@@ -0,0 +1,29 @@
+#ifdef _WIN32
+# include
+# include
+#else
+# include
+# include
+#endif
+
+#include "TracyWeb.hpp"
+
+namespace tracy
+{
+
+void OpenWebpage( const char* url )
+{
+#ifdef _WIN32
+ ShellExecuteA( nullptr, nullptr, url, nullptr, nullptr, 0 );
+#elif defined __APPLE__
+ char buf[1024];
+ sprintf( buf, "open %s", url );
+ system( buf );
+#else
+ char buf[1024];
+ sprintf( buf, "xdg-open %s", url );
+ system( buf );
+#endif
+}
+
+}
diff --git a/server/TracyWeb.hpp b/server/TracyWeb.hpp
new file mode 100644
index 00000000..fa6656db
--- /dev/null
+++ b/server/TracyWeb.hpp
@@ -0,0 +1,11 @@
+#ifndef __TRACYWEB_HPP__
+#define __TRACYWEB_HPP__
+
+namespace tracy
+{
+
+void OpenWebpage( const char* url );
+
+}
+
+#endif