summaryrefslogtreecommitdiff
path: root/gfx.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-08-20 10:50:23 +0000
committerrubidium <rubidium@openttd.org>2006-08-20 10:50:23 +0000
commit0c3093b25f3d53651b63fc6b86bf9285a26ed8c1 (patch)
tree0318097a982d451f4e952e486ef2f399c5b7e4bc /gfx.c
parent5890ea5a716bf74f6925adc3485c3c0e2e27b6ab (diff)
downloadopenttd-0c3093b25f3d53651b63fc6b86bf9285a26ed8c1.tar.xz
(svn r5967) -Change: use right alignment for the year in the player's balance window instead of centering (about) 'string width' / 2 from the right edge
Diffstat (limited to 'gfx.c')
-rw-r--r--gfx.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gfx.c b/gfx.c
index 58c22767e..f04c17aa6 100644
--- a/gfx.c
+++ b/gfx.c
@@ -352,12 +352,16 @@ int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw)
}
-void DrawStringRightAligned(int x, int y, StringID str, uint16 color)
+int DrawStringRightAligned(int x, int y, StringID str, uint16 color)
{
char buffer[512];
+ int w;
GetString(buffer, str);
- DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
+ w = GetStringWidth(buffer);
+ DoDrawString(buffer, x - w, y, color);
+
+ return w;
}
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw)
@@ -368,6 +372,12 @@ void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, u
DoDrawString(buffer, x - GetStringWidth(buffer), y, color);
}
+void DrawStringRightAlignedUnderline(int x, int y, StringID str, uint16 color)
+{
+ int w = DrawStringRightAligned(x, y, str, color);
+ GfxFillRect(x - w, y + 10, x, y + 10, _string_colorremap[1]);
+}
+
int DrawStringCentered(int x, int y, StringID str, uint16 color)
{