demos: Handle paint events and call RedrawWindow to animate
authorTony Barbour <tony@LunarG.com>
Tue, 20 Oct 2015 18:49:46 +0000 (12:49 -0600)
committerTony Barbour <tony@LunarG.com>
Wed, 21 Oct 2015 22:45:06 +0000 (16:45 -0600)
This keeps MessageBoxs from validation on Windows from hanging the
demos, while allowing the demo to animate

demos/cube.c
demos/tri.c

index a57bf4f..12de7f5 100644 (file)
@@ -1814,7 +1814,7 @@ LRESULT CALLBACK WndProc(HWND hWnd,
         break;
     case WM_PAINT:
         demo_run(&demo);
-        return 0;
+        break;
     default:
         break;
     }
@@ -2536,6 +2536,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
             TranslateMessage(&msg); 
             DispatchMessage(&msg);
         }
+        RedrawWindow(demo.window, NULL, NULL, RDW_INTERNALPAINT);
     }
 
     demo_cleanup(&demo);
index 06321c2..ef9ff42 100644 (file)
@@ -1487,7 +1487,7 @@ LRESULT CALLBACK WndProc(HWND hWnd,
     case WM_PAINT:
         if (demo.prepared) {
             demo_run(&demo);
-            return 0;
+            break;
         }
     default:
         break;
@@ -2193,6 +2193,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
             TranslateMessage(&msg); 
             DispatchMessage(&msg);
         }
+        RedrawWindow(demo.window, NULL, NULL, RDW_INTERNALPAINT);
     }
 
     demo_cleanup(&demo);