X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fgadgets.c;h=56c359bcc1a0e636c658430e578ef1e5f6e169e5;hb=0359b2734a5f3014bde4563756fbc9cdb0be62f7;hp=1004199f40d45bdd9cf405ca4398a71f1e75d045;hpb=f73405762b7a66ebed17c0f6fa56e909d7e5626f;p=rocksndiamonds.git diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 1004199f..56c359bc 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -4,7 +4,7 @@ // (c) 1995-2014 by Artsoft Entertainment // Holger Schemel // info@artsoft.org -// http://www.artsoft.org/ +// https://www.artsoft.org/ // ---------------------------------------------------------------------------- // gadgets.c // ============================================================================ @@ -78,7 +78,7 @@ static int getNewGadgetID(void) } if (next_free_gadget_id <= 0) // cannot get new gadget id - Error(ERR_EXIT, "too much gadgets -- this should not happen"); + Fail("too much gadgets -- this should not happen"); return id; } @@ -808,7 +808,8 @@ static void DrawGadget_OverlayTouchButton(struct GadgetInfo *gi) int alpha_max = SDL_ALPHA_OPAQUE; int alpha_step = ALPHA_FADING_STEPSIZE(alpha_max); - if (gi->mapped) + // only show mapped overlay touch buttons if touch screen is really used + if (gi->mapped && runtime.uses_touch_device) { if (alpha < alpha_max) alpha = MIN(alpha + alpha_step, alpha_max); @@ -883,7 +884,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) while (tag != GDI_END) { - switch(tag) + switch (tag) { case GDI_IMAGE_ID: gi->image_id = va_arg(ap, int); @@ -1206,7 +1207,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) break; default: - Error(ERR_EXIT, "HandleGadgetTags(): unknown tag %d", tag); + Fail("HandleGadgetTags(): unknown tag %d", tag); } tag = va_arg(ap, int); // read next tag @@ -1267,7 +1268,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) gi->height = 2 * border_ysize + font_height; if (gi->selectbox.options == NULL) - Error(ERR_EXIT, "selectbox gadget incomplete (missing options array)"); + Fail("selectbox gadget incomplete (missing options array)"); gi->selectbox.num_values = 0; while (gi->selectbox.options[gi->selectbox.num_values].text != NULL) @@ -1329,7 +1330,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) if (gi->width == 0 || gi->height == 0 || gs->items_max == 0 || gs->items_visible == 0) - Error(ERR_EXIT, "scrollbar gadget incomplete (missing tags)"); + Fail("scrollbar gadget incomplete (missing tags)"); // calculate internal scrollbar values gs->size_min = (gi->type == GD_TYPE_SCROLLBAR_VERTICAL ? @@ -1478,6 +1479,10 @@ static void MapGadgetExt(struct GadgetInfo *gi, boolean redraw) if (gi == NULL || gi->deactivated || gi->mapped) return; + // do not map overlay touch buttons if touch screen is not used + if (gi->overlay_touch_button && !runtime.uses_touch_device) + return; + gi->mapped = TRUE; if (redraw)