summaryrefslogtreecommitdiff
path: root/src/gfx_func.h
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-07-02 13:53:05 +0000
committeralberth <alberth@openttd.org>2010-07-02 13:53:05 +0000
commit22b9bc515730e40ad834a5295d9421afeaf8802e (patch)
tree2c953357d0f0b51c676cb6f63bf8477e3a997c80 /src/gfx_func.h
parent3d329beb1b9a882fbc6530817a169ab6588e646f (diff)
downloadopenttd-22b9bc515730e40ad834a5295d9421afeaf8802e.tar.xz
(svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine().
Diffstat (limited to 'src/gfx_func.h')
-rw-r--r--src/gfx_func.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gfx_func.h b/src/gfx_func.h
index d76e02f01..2c7b33dc8 100644
--- a/src/gfx_func.h
+++ b/src/gfx_func.h
@@ -93,18 +93,26 @@ void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub
/** How to align the to-be drawn text. */
enum StringAlignment {
- SA_LEFT, ///< Left align the text
- SA_CENTER, ///< Center the text
- SA_RIGHT, ///< Right align the text
- SA_MASK = 3, ///< Mask for base alignment
- SA_FORCE = 4, ///< Force the alignment, i.e. don't swap for RTL languages.
- SA_STRIP = 8, ///< Strip the SETX/SETXY commands from the string
+ SA_LEFT = 0 << 0, ///< Left align the text.
+ SA_HOR_CENTER = 1 << 0, ///< Horizontally center the text.
+ SA_RIGHT = 2 << 0, ///< Right align the text (must be a single bit).
+ SA_HOR_MASK = 3 << 0, ///< Mask for horizontal alignment.
+
+ SA_TOP = 0 << 2, ///< Top align the text.
+ SA_VERT_CENTER = 1 << 2, ///< Vertically center the text.
+ SA_BOTTOM = 2 << 2, ///< Bottom align the text.
+ SA_VERT_MASK = 3 << 2, ///< Mask for vertical alignment.
+
+ SA_CENTER = SA_HOR_CENTER | SA_VERT_CENTER, ///< Center both horizontally and vertically.
+
+ SA_FORCE = 1 << 4, ///< Force the alignment, i.e. don't swap for RTL languages.
+ SA_STRIP = 1 << 5, ///< Strip the SETX/SETXY commands from the string
};
DECLARE_ENUM_AS_BIT_SET(StringAlignment)
int DrawString(int left, int right, int top, const char *str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false);
int DrawString(int left, int right, int top, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false);
-int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false);
+int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = (SA_TOP | SA_LEFT), bool underline = false);
void DrawCharCentered(uint32 c, int x, int y, TextColour colour);