diff options
author | rubidium <rubidium@openttd.org> | 2009-03-21 18:28:01 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-21 18:28:01 +0000 |
commit | a22559ff9520f78a9ca89505d275e4d67c1a845a (patch) | |
tree | 91b8f41f8a7a12761978f6e0316a4fc42fa4fd03 /src/gfx_func.h | |
parent | 529dd0867f451cf3befbdf3feb3da146c77bd416 (diff) | |
download | openttd-a22559ff9520f78a9ca89505d275e4d67c1a845a.tar.xz |
(svn r15779) -Codechange: unify (most) of the text drawing "API".
Diffstat (limited to 'src/gfx_func.h')
-rw-r--r-- | src/gfx_func.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gfx_func.h b/src/gfx_func.h index eedf34604..97795e48a 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -85,6 +85,16 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo); 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 DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw 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); |