tracy/server/TracyImGui.hpp

25 lines
637 B
C++
Raw Normal View History

2017-09-17 22:18:36 +00:00
#ifndef __TRACYIMGUI_HPP__
#define __TRACYIMGUI_HPP__
#include "../imgui/imgui.h"
#include "../imgui/imgui_internal.h"
#if !IMGUI_DEFINE_MATH_OPERATORS
2018-04-21 21:19:13 +00:00
static inline ImVec2 operator+( const ImVec2& l, const ImVec2& r ) { return ImVec2( l.x + r.x, l.y + r.y ); }
static inline ImVec2 operator-( const ImVec2& l, const ImVec2& r ) { return ImVec2( l.x - r.x, l.y - r.y ); }
#endif
2017-09-17 22:18:36 +00:00
2018-08-17 21:07:58 +00:00
namespace tracy
{
static inline void TextCentered( const char* text )
{
const auto tw = ImGui::CalcTextSize( text ).x;
ImGui::SetCursorPosX( ( ImGui::GetWindowWidth() - tw ) * 0.5f );
ImGui::Text( text );
}
}
2017-09-17 22:18:36 +00:00
#endif