I want centered message on window
how ?
You have to do it manually at the moment (using CalcTextSize + SetCursorPosX + Text).
There are internal api doing it but they aren't finalised.
Closing this. I hope to add better alignment primitives in the future.
thanks for the method !
Is this not in the API yet?
No it isn't yet.
void TextCenter(std::string text) {
float font_size = ImGui::GetFontSize() * text.size() / 2;
ImGui::SameLine(
ImGui::GetWindowSize().x / 2 -
font_size + (font_size / 2)
);
ImGui::Text(text.c_str());
}
Most helpful comment
You have to do it manually at the moment (using CalcTextSize + SetCursorPosX + Text).
There are internal api doing it but they aren't finalised.