rnd-20030304-1-src
[rocksndiamonds.git] / src / libgame / gadgets.c
index a371bb473505a3f8eccfd5425d8e4a7c68d8e10c..66a8e2b340bfcd7848cb05e3e349b15c1c3bbb1a 100644 (file)
@@ -136,30 +136,31 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
        char cursor_string[3];
        char text[MAX_GADGET_TEXTSIZE + 1];
        int font_type = gi->text.font_type;
-       int font_width = getFontWidth(FS_SMALL, font_type);
+       int font_width = getFontWidth(font_type);
        int border = gi->border.size;
+
        strcpy(text, gi->text.value);
        strcat(text, " ");
 
        /* left part of gadget */
-       BlitBitmap(gd->bitmap, drawto,
-                  gd->x, gd->y, border, gi->height, gi->x, gi->y);
+       BlitBitmapOnBackground(gd->bitmap, drawto,
+                              gd->x, gd->y, border, gi->height, gi->x, gi->y);
 
        /* middle part of gadget */
        for (i=0; i<=gi->text.size; i++)
-         BlitBitmap(gd->bitmap, drawto,
-                    gd->x + border, gd->y, font_width, gi->height,
-                    gi->x + border + i * font_width, gi->y);
+         BlitBitmapOnBackground(gd->bitmap, drawto,
+                                gd->x + border, gd->y, font_width, gi->height,
+                                gi->x + border + i * font_width, gi->y);
 
        /* right part of gadget */
-       BlitBitmap(gd->bitmap, drawto,
-                  gd->x + gi->border.width - border, gd->y,
-                  border, gi->height, gi->x + gi->width - border, gi->y);
+       BlitBitmapOnBackground(gd->bitmap, drawto,
+                              gd->x + gi->border.width -border, gd->y, border,
+                              gi->height, gi->x + gi->width - border, gi->y);
 
        /* gadget text value */
        DrawTextExt(drawto,
                    gi->x + border, gi->y + border, text,
-                   FS_SMALL, font_type, FONT_OPAQUE);
+                   font_type, FONT_MASKED);
 
        cursor_letter = gi->text.value[gi->text.cursor_position];
        cursor_string[0] = '~';
@@ -171,7 +172,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
          DrawTextExt(drawto,
                      gi->x + border + gi->text.cursor_position * font_width,
                      gi->y + border, cursor_string,
-                     FS_SMALL, font_type, FONT_OPAQUE);
+                     font_type, FONT_MASKED);
       }
       break;
 
@@ -529,8 +530,8 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
 
   if (gi->type & GD_TYPE_TEXTINPUT)
   {
-    int font_width = getFontWidth(FS_SMALL, gi->text.font_type);
-    int font_height = getFontHeight(FS_SMALL, gi->text.font_type);
+    int font_width = getFontWidth(gi->text.font_type);
+    int font_height = getFontHeight(gi->text.font_type);
 
     gi->width = 2 * gi->border.size + (gi->text.size + 1) * font_width;
     gi->height = 2 * gi->border.size + font_height;
@@ -802,7 +803,7 @@ void HandleGadgets(int mx, int my, int button)
       /* if mouse button pressed inside activated text gadget, set cursor */
       gi->text.cursor_position =
        (mx - gi->x - gi->border.size) /
-       getFontWidth(FS_SMALL, gi->text.font_type);
+       getFontWidth(gi->text.font_type);
 
       if (gi->text.cursor_position < 0)
        gi->text.cursor_position = 0;