mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Allow connecting to remote client.
This commit is contained in:
parent
1955d50ff8
commit
a2fa319a42
@ -1,12 +1,11 @@
|
|||||||
// ImGui - standalone example application for Glfw + OpenGL 3, using programmable pipeline
|
|
||||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
|
||||||
|
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include "imgui_impl_glfw_gl3.h"
|
#include "imgui_impl_glfw_gl3.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <GL/gl3w.h> // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you.
|
#include <GL/gl3w.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "../../server/TracyView.hpp"
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
{
|
{
|
||||||
@ -25,7 +24,7 @@ int main(int, char**)
|
|||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
#endif
|
#endif
|
||||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui OpenGL3 example", NULL, NULL);
|
GLFWwindow* window = glfwCreateWindow(1650, 960, "Tracy server", NULL, NULL);
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval(1); // Enable vsync
|
glfwSwapInterval(1); // Enable vsync
|
||||||
gl3wInit();
|
gl3wInit();
|
||||||
@ -43,42 +42,30 @@ int main(int, char**)
|
|||||||
//io.Fonts->AddFontFromFileTTF("../../extra_fonts/ProggyTiny.ttf", 10.0f);
|
//io.Fonts->AddFontFromFileTTF("../../extra_fonts/ProggyTiny.ttf", 10.0f);
|
||||||
//io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
//io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||||
|
|
||||||
bool show_test_window = true;
|
|
||||||
bool show_another_window = false;
|
|
||||||
ImVec4 clear_color = ImColor(114, 144, 154);
|
ImVec4 clear_color = ImColor(114, 144, 154);
|
||||||
|
|
||||||
|
char addr[1024] = { "127.0.0.1" };
|
||||||
|
std::unique_ptr<tracy::View> view;
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window))
|
||||||
{
|
{
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
ImGui_ImplGlfwGL3_NewFrame();
|
ImGui_ImplGlfwGL3_NewFrame();
|
||||||
|
|
||||||
// 1. Show a simple window
|
if( !view )
|
||||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug"
|
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
ImGui::Begin( "Connect to..." );
|
||||||
ImGui::Text("Hello, world!");
|
ImGui::InputText( "Address", addr, 1024 );
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
if( ImGui::Button( "Connect" ) && *addr )
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color);
|
{
|
||||||
if (ImGui::Button("Test Window")) show_test_window ^= 1;
|
view = std::make_unique<tracy::View>( addr );
|
||||||
if (ImGui::Button("Another Window")) show_another_window ^= 1;
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Show another simple window, this time using an explicit Begin/End pair
|
|
||||||
if (show_another_window)
|
|
||||||
{
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(200,100), ImGuiCond_FirstUseEver);
|
|
||||||
ImGui::Begin("Another Window", &show_another_window);
|
|
||||||
ImGui::Text("Hello");
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
|
|
||||||
if (show_test_window)
|
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver);
|
view->Draw();
|
||||||
ImGui::ShowTestWindow(&show_test_window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
|
Loading…
Reference in New Issue
Block a user