diff options
author | rubidium <rubidium@openttd.org> | 2009-03-21 22:00:00 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-21 22:00:00 +0000 |
commit | 900364109597f02413e2f7a59e9b4e6cc9fdf97f (patch) | |
tree | 308b7c3eda7e63a306620580ef4df5f4b99b893e /src/gfx.cpp | |
parent | d452a0a0ecaad276c893b62ab8f008a5af85ba82 (diff) | |
download | openttd-900364109597f02413e2f7a59e9b4e6cc9fdf97f.tar.xz |
(svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
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 |