diff options
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r-- | src/gfx.cpp | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp index a65b30131..aef176151 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -424,7 +424,7 @@ static int DrawString(int left, int right, int top, char *str, const char *last, break; case SA_CENTER: - left += (right - left - w) / 2; + left += (right - left - w + 1) / 2; right = left + w; break; @@ -510,55 +510,6 @@ int DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colou } /** - * Draw string centered. - * - * @param x X position of center of the string - * @param y Y position of center of the string - * @param str String to draw - * @param colour Colour used for drawing the string, see DoDrawString() for details - */ -int DrawStringCentered(int x, int y, StringID str, TextColour colour) -{ - char buffer[DRAW_STRING_BUFFER]; - GetString(buffer, str, lastof(buffer)); - int w = GetStringBoundingBox(buffer).width; - return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, SA_CENTER); -} - -/** - * Draw string centered. - * - * @param x X position of center of the string - * @param y Y position of center of the string - * @param str String to draw - * @param colour Colour used for drawing the string, see DoDrawString() for details - */ -int DoDrawStringCentered(int x, int y, const char *str, TextColour colour) -{ - char buffer[DRAW_STRING_BUFFER]; - strecpy(buffer, str, lastof(buffer)); - - int w = GetStringBoundingBox(buffer).width; - return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, SA_CENTER); -} - -/** - * Draw string centered, with additional line underneath it - * - * @param x X position of center of the string - * @param y Y position of center of the string - * @param str String to draw - * @param colour Colour used for drawing the string, see DoDrawString() for details - */ -int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour) -{ - char buffer[DRAW_STRING_BUFFER]; - GetString(buffer, str, lastof(buffer)); - int w = GetStringBoundingBox(buffer).width; - return DrawString(x - w, y + w, y, buffer, lastof(buffer), colour, SA_CENTER, true); -} - -/** * 'Correct' a string to a maximum length. Longer strings will be cut into * additional lines at whitespace characters if possible. The string parameter * is modified with terminating characters mid-string which are the |