Mercurial > hg > openttd
diff src/gfx_func.h @ 11421:d869783cce0d draft
(svn r15779) -Codechange: unify (most) of the text drawing "API".
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 21 Mar 2009 18:28:01 +0000 (2009-03-21) |
parents | 9ec1f7eac0a0 |
children | 4e723beaac18 |
line wrap: on
line diff
--- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -85,6 +85,16 @@ void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL); +/** How to align the to-be drawn text. */ +enum TextAlignment { + TA_LEFT, ///< Left align the text + TA_CENTER, ///< Center the text + TA_RIGHT, ///< Right align the text +}; + +int DrawString(int left, int right, int top, const char *str, TextColour colour, TextAlignment align = TA_LEFT, bool underline = false); +int DrawString(int left, int right, int top, StringID str, TextColour colour, TextAlignment align = TA_LEFT, bool underline = false); + int DrawStringCentered(int x, int y, StringID str, TextColour colour); int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, TextColour colour); int DoDrawStringCentered(int x, int y, const char *str, TextColour colour); @@ -95,12 +105,12 @@ int DoDrawString(const char *string, int x, int y, TextColour colour, bool parse_string_also_when_clipped = false); int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw); -void DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour); -void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour); +int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour); +int DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour); int DrawStringRightAligned(int x, int y, StringID str, TextColour colour); -void DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw); -void DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour); +int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw); +int DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour); void DrawCharCentered(uint32 c, int x, int y, TextColour colour);