Centered text helper.

This commit is contained in:
Bartosz Taudul 2018-08-17 23:07:58 +02:00
parent 4c393a2b8d
commit e1e0e6e140

View File

@ -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