diff options
author | Bartosz Taudul <wolf.pld@gmail.com> | 2018-08-18 00:07:58 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf.pld@gmail.com> | 2018-08-18 00:07:58 +0300 |
commit | e1e0e6e1403368a166db7644fe3ca0de166fd6d6 (patch) | |
tree | 13afd04ba4579ec796653f9b41c9a1e88b10ed12 | |
parent | 4c393a2b8d45ccabad3b6b4776a8d689bdcb6497 (diff) |
Centered text helper.
-rw-r--r-- | server/TracyImGui.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/server/TracyImGui.hpp b/server/TracyImGui.hpp index 2d486185..703eb905 100644 --- a/server/TracyImGui.hpp +++ b/server/TracyImGui.hpp @@ -9,4 +9,16 @@ static inline ImVec2 operator+( const ImVec2& l, const ImVec2& r ) { return ImVe static inline ImVec2 operator-( const ImVec2& l, const ImVec2& r ) { return ImVec2( l.x - r.x, l.y - r.y ); } #endif +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 ); + } + +} + #endif |