projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
moved video frame synchronization to single location (screen update)
[rocksndiamonds.git]
/
src
/
libgame
/
sdl.c
diff --git
a/src/libgame/sdl.c
b/src/libgame/sdl.c
index 2507be4c97da205b22edef149ac0e413b7716091..480677c31bb117b3f26c07ccca2351f6841a2b42 100644
(file)
--- a/
src/libgame/sdl.c
+++ b/
src/libgame/sdl.c
@@
-145,10
+145,14
@@
static void UpdateScreen(SDL_Rect *rect)
SDL_SetRenderTarget(sdl_renderer, NULL);
SDL_RenderCopy(sdl_renderer, sdl_texture_target, NULL, NULL);
}
SDL_SetRenderTarget(sdl_renderer, NULL);
SDL_RenderCopy(sdl_renderer, sdl_texture_target, NULL, NULL);
}
+#endif
- //
show render target buffer on screen
-
SDL_RenderPresent(sdl_renderer
);
+ //
global synchronization point of the game to align video frame delay
+
WaitUntilDelayReached(&video.frame_delay, video.frame_delay_value
);
+#if defined(TARGET_SDL2)
+ // show render target buffer on screen
+ SDL_RenderPresent(sdl_renderer);
#else // TARGET_SDL
if (rect)
SDL_UpdateRects(screen, 1, rect);
#else // TARGET_SDL
if (rect)
SDL_UpdateRects(screen, 1, rect);
@@
-1169,10
+1173,7
@@
void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
while (time_current < time_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
+ // updating the screen contains waiting for frame delay (non-busy)
UpdateScreen(NULL);
time_current = SDL_GetTicks();
UpdateScreen(NULL);
time_current = SDL_GetTicks();