From 0d69b68e9fe75ce7414b0effaa954292056309a2 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 8 Feb 2016 21:03:42 +0100 Subject: [PATCH] added drawing global animations during post delay of screen fading --- src/libgame/sdl.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 182126f1..99662153 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -1396,7 +1396,24 @@ void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, } } - Delay(post_delay); + 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) + { + // do not wait longer than 10 ms at a time to be able to ... + Delay(MIN(10, time_post_delay - time_current)); + + // ... continue drawing global animations during post delay + UpdateScreen(NULL); + + time_current = SDL_GetTicks(); + } + } } void SDLDrawSimpleLine(Bitmap *dst_bitmap, int from_x, int from_y, -- 2.34.1