From: Holger Schemel Date: Mon, 8 Feb 2016 20:03:42 +0000 (+0100) Subject: added drawing global animations during post delay of screen fading X-Git-Tag: 4.0.0.0-rc1~82 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0d69b68e9fe75ce7414b0effaa954292056309a2;p=rocksndiamonds.git added drawing global animations during post delay of screen fading --- 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,