Fix centered draws without a max width

(probably ;P)
This commit is contained in:
Pk11
2020-01-02 23:50:31 -06:00
parent f24e7375fe
commit 9803bdc90a
+1 -1
View File
@@ -156,7 +156,7 @@ void Gui::DisplayWarnMsg(std::string Text)
}
void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth) {
Gui::DrawString((currentScreen ? 200 : 160)+x-(std::min(maxWidth, (int)Gui::GetStringWidth(size, Text))/2), y, size, color, Text, maxWidth);
Gui::DrawString((currentScreen ? 200 : 160)+x-((maxWidth == 0 ? (int)Gui::GetStringWidth(size, Text) : std::min(maxWidth, (int)Gui::GetStringWidth(size, Text)))/2), y, size, color, Text, maxWidth);
}
// Draw String or Text.