From 327e870962e53a9ae809f588d520f216274679ed Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 26 Mar 2008 10:08:17 +0000 Subject: (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik. --- src/gfx.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/gfx.cpp') 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 -- cgit v1.2.3-54-g00ecf