summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-03-26 10:08:17 +0000
committerrubidium <rubidium@openttd.org>2008-03-26 10:08:17 +0000
commit327e870962e53a9ae809f588d520f216274679ed (patch)
tree6f0a8507b3787ee4fc264a975c90db6c455c39a1 /src/gfx.cpp
parent06c0e5df5a9b043ef9745e3c2cc1653847a110ab (diff)
downloadopenttd-327e870962e53a9ae809f588d520f216274679ed.tar.xz
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 49d565b29..734ae590c 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -561,6 +561,20 @@ Dimension GetStringBoundingBox(const char *str)
return br;
}
+void DrawCharCentered(WChar c, int x, int y, uint16 real_color)
+{
+ FontSize size = FS_NORMAL;
+ byte color = real_color & 0xFF;
+ uint palette = _use_dos_palette ? 1 : 0;
+ int w = GetCharacterWidth(size, c);
+
+ _string_colorremap[1] = _string_colormap[palette][color].text;
+ _string_colorremap[2] = _string_colormap[palette][color].shadow;
+ _color_remap_ptr = _string_colorremap;
+
+ GfxMainBlitter(GetGlyph(size, c), x - w / 2, y, BM_COLOUR_REMAP);
+}
+
/** Draw a string at the given coordinates with the given colour
* @param string the string to draw
* @param x offset from left side of the screen, if negative offset from the right side