projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7791c3e
)
added dirty workaround to erase text if input gadget font has draw offset
author
Holger Schemel
<info@artsoft.org>
Wed, 8 Mar 2023 20:39:56 +0000
(21:39 +0100)
committer
Holger Schemel
<info@artsoft.org>
Wed, 8 Mar 2023 20:42:55 +0000
(21:42 +0100)
src/libgame/gadgets.c
patch
|
blob
|
history
diff --git
a/src/libgame/gadgets.c
b/src/libgame/gadgets.c
index cefffd27dd469d64baf3998ab77c9233511d59f6..b917b43df0ffeabd65c22bbacf173fc571ec14b2 100644
(file)
--- 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);
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 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,
// 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, " ");
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,
// gadget text value
DrawTextExt(drawto,
gi->x + border_x, gi->y + border_y, text,