diff test/testoverlay2.c @ 753:b14fdadd8311

Date: Thu, 4 Dec 2003 07:48:40 +0200 From: "Mike Gorchak" Subject: SDL/QNX6 new patch Here in attachment my patch for the SDL/QNX6 again :) It contain non-crtitical/cosmetic fixes: 1. Fixed window centering at other than the first consoles. 2. Fixed window centering algorithm in case when window height or width are greater than the desktop resolution. 3. Fixed window positioning on other than the first consoles. 4. Fixed occasional input focus lost when switching to fullscreen. 5. Removed the Photon's default chroma color for the overlays, added RGB(12, 6, 12) color instead (very dark pink). 6. Added more checks to the YUV overlay code (fixed crashes during resolution mode switches). 7. Added support for Enter/Backspace keys in unicode mode (used by Maelstrom and by other games). 8. Fixed window restore/maximize function. It works, finally.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 10 Dec 2003 12:35:56 +0000
parents 63419da96d13
children 05c551e5bc64
line wrap: on
line diff
--- a/test/testoverlay2.c	Wed Dec 10 12:32:38 2003 +0000
+++ b/test/testoverlay2.c	Wed Dec 10 12:35:56 2003 +0000
@@ -275,6 +275,7 @@
     SDL_Event event;
     Uint32 lastftick;
     int paused=0;
+    int resized=0;
     int i;
     int fps=12;
     int fpsdelay;
@@ -505,6 +506,10 @@
                      screen=SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_RESIZABLE | SDL_SWSURFACE);
                      overlayrect.w=event.resize.w;
                      overlayrect.h=event.resize.h;
+                     if (paused)
+                     {
+                         resized=1;
+                     }
                      break;
                 case SDL_KEYDOWN:
                      if (event.key.keysym.sym == SDLK_SPACE)
@@ -526,9 +531,9 @@
             }
         }
 
-        if (!paused)
+        if ((!paused)||(resized))
         {
-            if ((SDL_GetTicks()-lastftick)>fpsdelay)
+            if (((SDL_GetTicks()-lastftick)>fpsdelay)||(resized))
             {
                 lastftick=SDL_GetTicks();
 
@@ -552,10 +557,17 @@
                 }
 
                 SDL_DisplayYUVOverlay(overlay, &overlayrect);
-                i++;
-                if (i==10)
+                if (!resized)
                 {
-                    i=0;
+                    i++;
+                    if (i==10)
+                    {
+                        i=0;
+                    }
+                }
+                else
+                {
+                    resized=0;
                 }
             }
         }