X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=7a108238cbe56c5a4279f61f61bd0198d7c924aa;hp=ba3b6ac41eb601a9623acaa9d2b65b49da8037ac;hb=97d0f78c43d16fbf73ea0438148a4da781c75600;hpb=6c674ccdd458314ced75459649c6acf1489b6056 diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index ba3b6ac4..7a108238 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -131,12 +131,31 @@ static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay) SDL_Rect *src_rect1 = NULL, *dst_rect1 = NULL; SDL_Rect *src_rect2 = NULL, *dst_rect2 = NULL; -#if defined(HAS_SCREEN_KEYBOARD) - SDL_Rect src_rect_up = { 0, video.height / 2, video.width, video.height / 2 }; - SDL_Rect dst_rect_up = { 0, 0, video.width, video.height / 2 }; - if (video.shifted_up) +#if defined(HAS_SCREEN_KEYBOARD) + if (video.shifted_up || video.shifted_up_delay) { + int time_current = SDL_GetTicks(); + int pos = video.shifted_up_pos; + int pos_last = video.shifted_up_pos_last; + + if (!DelayReachedExt(&video.shifted_up_delay, video.shifted_up_delay_value, + time_current)) + { + int delay = time_current - video.shifted_up_delay; + int delay_value = video.shifted_up_delay_value; + + pos = pos_last + (pos - pos_last) * delay / delay_value; + } + else + { + video.shifted_up_pos_last = pos; + video.shifted_up_delay = 0; + } + + SDL_Rect src_rect_up = { 0, pos, video.width, video.height - pos }; + SDL_Rect dst_rect_up = { 0, 0, video.width, video.height - pos }; + if (video.screen_rendering_mode == SPECIAL_RENDERING_TARGET || video.screen_rendering_mode == SPECIAL_RENDERING_DOUBLE) {