X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=eee5d59ac56cee2d054f4ecbd79fa788982569c5;hb=a3554a32c803528ed6837477982d7fddcf60072c;hp=8ac2fc3af6e298f3eb3ba20fb8155c4607d64205;hpb=b857093af85a12103d638aa99962d16367935e49;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 8ac2fc3a..eee5d59a 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -245,6 +245,20 @@ static void UpdateScreen_WithoutFrameDelay(SDL_Rect *rect) UpdateScreenExt(rect, FALSE); } +void Delay_WithScreenUpdates(unsigned int delay) +{ + unsigned int time_current = SDL_GetTicks(); + unsigned int time_delayed = time_current + delay; + + while (time_current < time_delayed) + { + // updating the screen contains waiting for frame delay (non-busy) + UpdateScreen_WithFrameDelay(NULL); + + time_current = SDL_GetTicks(); + } +} + static void SDLSetWindowIcon(char *basename) { /* (setting the window icon on Mac OS X would replace the high-quality @@ -1389,20 +1403,7 @@ void SDLFadeRectangle(int x, int y, int width, int height, } if (post_delay > 0) - { - unsigned int time_post_delay; - - time_current = SDL_GetTicks(); - time_post_delay = time_current + post_delay; - - while (time_current < time_post_delay) - { - // updating the screen contains waiting for frame delay (non-busy) - UpdateScreen_WithFrameDelay(NULL); - - time_current = SDL_GetTicks(); - } - } + Delay_WithScreenUpdates(post_delay); // restore function for drawing global masked border gfx.draw_global_border_function = draw_global_border_function; @@ -3060,10 +3061,12 @@ static void DrawTouchInputOverlay_ShowGridButtons(int alpha) for (y = 0; y < grid_ysize; y++) { int grid_button = overlay.grid_button[x][y]; + int grid_button_action = GET_ACTION_FROM_GRID_BUTTON(grid_button); int alpha_draw = alpha; int outline_border = MV_NONE; int border_size = 2; boolean draw_outlined = setup.touch.draw_outlined; + boolean draw_pressed = setup.touch.draw_pressed; if (grid_button == CHAR_GRID_BUTTON_NONE) continue; @@ -3071,6 +3074,14 @@ static void DrawTouchInputOverlay_ShowGridButtons(int alpha) if (grid_button == overlay.grid_button_highlight) alpha_draw = alpha_highlight; + if (draw_pressed && overlay.grid_button_action & grid_button_action) + { + if (draw_outlined) + draw_outlined = FALSE; + else + alpha_draw = MIN((float)alpha_draw * 1.5, SDL_ALPHA_OPAQUE); + } + SDL_SetRenderDrawColor(sdl_renderer, 255, 255, 255, alpha_draw); rect.x = (x + 0) * video.screen_width / grid_xsize;