diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index 9750fb917d..183ce97f3c 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -50,7 +50,7 @@ void PSPDialog::EndDraw() void PSPDialog::DisplayMessage(std::string text) { - PPGeDrawText(text.c_str(), 480/2, 100, PPGE_ALIGN_CENTER, 0.5f, 0xFFFFFFFF); + PPGeDrawText(text.c_str(), 40, 30, PPGE_ALIGN_LEFT, 0.5f, 0xFFFFFFFF); } int PSPDialog::Shutdown() diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index bd8032dd0b..cbd3bce81f 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -238,18 +238,20 @@ static void PPGeMeasureText(const char *text, float scale, float *w, float *h) { const AtlasFont &atlasfont = *ppge_atlas.fonts[0]; unsigned char cval; float wacc = 0; + float maxw = 0; int lines = 1; while ((cval = *text++) != '\0') { if (cval < 32) continue; if (cval > 127) continue; if (cval == '\n') { + if (wacc > maxw) maxw = wacc; wacc = 0; lines++; } AtlasChar c = atlasfont.chars[cval - 32]; wacc += c.wx * scale; } - if (w) *w = wacc; + if (w) *w = maxw; if (h) *h = atlasfont.height * scale * lines; } @@ -278,6 +280,7 @@ void PPGeDrawText(const char *text, float x, float y, int align, float scale, u3 float sx = x; while ((cval = *text++) != '\0') { if (cval == '\n') { + // This is not correct when centering or right-justifying, need to set x depending on line width (tricky) y += atlasfont.height * scale; x = sx; continue;