If a test program window resizes, resize its viewport, too.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 28 Mar 2011 23:20:54 -0400
changeset 5521 ef550bdb8c1b
parent 5520 09b500e0656d
child 5522 38bd9696f659
If a test program window resizes, resize its viewport, too.
test/common.c
--- a/test/common.c	Mon Mar 28 23:21:22 2011 -0400
+++ b/test/common.c	Mon Mar 28 23:20:54 2011 -0400
@@ -1040,6 +1040,24 @@
 				}
 			}
             break;
+
+        case SDL_WINDOWEVENT_RESIZED:
+            {
+                SDL_Window *window = SDL_GetWindowFromID(event->window.windowID);
+                if (!window) {
+                    break;
+                }
+
+                for (i = 0; i < state->num_windows; ++i) {
+                    if (state->windows[i] == window) {
+                        if (state->renderers[i]) {
+                            SDL_RenderSetViewport(state->renderers[i], NULL);
+                        }
+                        break;
+                    }
+                }
+            }
+            break;
         }
         break;
     case SDL_KEYDOWN: