]> git.localhorst.tv Git - l2e.git/blobdiff - src/sdl/InitScreen.cpp
introduced a small delay after flip if the screen is not a hardware surface
[l2e.git] / src / sdl / InitScreen.cpp
index 76030b1df0067aa610428cb93eff3ba7ca168848..13fb6b620bfef50d4a27bef256626659eefe3f7d 100644 (file)
@@ -27,6 +27,7 @@ InitScreen::~InitScreen(void) {
 
 }
 
+
 SDL_Surface *InitScreen::Resize(int width, int height) {
        SDL_Surface *newScreen(SDL_SetVideoMode(width, height, bpp, flags));
        if (!newScreen) {
@@ -35,4 +36,12 @@ SDL_Surface *InitScreen::Resize(int width, int height) {
        return screen = newScreen;
 }
 
+void InitScreen::Flip(void) {
+       SDL_Flip(screen);
+       if (!(screen->flags & SDL_HWSURFACE)) {
+               // probably got no vsync, so suspend execution for a while
+               SDL_Delay(1);
+       }
+}
+
 }