From: Holger Schemel Date: Wed, 8 Mar 2023 20:39:56 +0000 (+0100) Subject: added dirty workaround to erase text if input gadget font has draw offset X-Git-Tag: 4.3.5.2~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4059479ac8cf37a1fd4645edf6d5a878df8dcfda;p=rocksndiamonds.git added dirty workaround to erase text if input gadget font has draw offset --- diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index cefffd27..b917b43d 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -346,8 +346,12 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) char text[MAX_GADGET_TEXTSIZE + 1]; int font_nr = (pressed ? gi->font_active : gi->font); int font_width = getFontWidth(font_nr); + int font_height = getFontHeight(font_nr); + struct FontBitmapInfo *font = getFontBitmapInfo(font_nr); int border_x = gi->border.xsize; int border_y = gi->border.ysize; + int text_x = gi->x + font->draw_xoffset; + int text_y = gi->y + font->draw_yoffset; // left part of gadget BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y, @@ -369,6 +373,15 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) strcpy(text, gi->textinput.value); strcat(text, " "); + // dirty workaround to erase text if input gadget font has draw offset + if (font->draw_xoffset != 0 || font->draw_yoffset != 0) + for (i = 0; i < gi->textinput.size + 1; i++) + BlitBitmapOnBackground(gd->bitmap, drawto, + gd->x + border_x, gd->y + border_y, + font_width, font_height, + text_x + border_x + i * font_width, + text_y + border_y); + // gadget text value DrawTextExt(drawto, gi->x + border_x, gi->y + border_y, text,