demo_draw(demo);
demo->curFrame++;
- if (demo->frameCount != INT_MAX && demo->curFrame == demo->frameCount) {
+ if (demo->frameCount != INT32_MAX && demo->curFrame == demo->frameCount) {
PostQuitMessage(validation_error);
}
}
demo_resize(&demo);
}
break;
+ case WM_KEYDOWN:
+ switch (wParam) {
+ case VK_ESCAPE:
+ PostQuitMessage(validation_error);
+ break;
+ case VK_LEFT:
+ demo.spin_angle -= demo.spin_increment;
+ break;
+ case VK_RIGHT:
+ demo.spin_angle += demo.spin_increment;
+ break;
+ case VK_SPACE:
+ demo.pause = !demo.pause;
+ break;
+ }
+ return 0;
default:
break;
}
// main message loop
while (!done) {
+ if (demo.pause) {
+ const BOOL succ = WaitMessage();
+
+ if (!succ) {
+ struct demo *tmp = &demo;
+ struct demo *demo = tmp;
+ ERR_EXIT("WaitMessage() failed on paused demo", "event loop error");
+ }
+ }
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
if (msg.message == WM_QUIT) // check for a quit message
{
draw();
curFrame++;
- if (frameCount != INT_MAX && curFrame == frameCount) {
+ if (frameCount != UINT32_MAX && curFrame == frameCount) {
PostQuitMessage(validation_error);
}
}
draw();
curFrame++;
- if (frameCount != INT32_MAX && curFrame == frameCount) {
+ if (frameCount != UINT32_MAX && curFrame == frameCount) {
quit = true;
}
}
demo.resize();
}
break;
+ case WM_KEYDOWN:
+ switch (wParam) {
+ case VK_ESCAPE:
+ PostQuitMessage(validation_error);
+ break;
+ case VK_LEFT:
+ demo.spin_angle -= demo.spin_increment;
+ break;
+ case VK_RIGHT:
+ demo.spin_angle += demo.spin_increment;
+ break;
+ case VK_SPACE:
+ demo.pause = !demo.pause;
+ break;
+ }
+ return 0;
default:
break;
}
// main message loop
while (!done) {
+ if (demo.pause) {
+ const BOOL succ = WaitMessage();
+
+ if (!succ) {
+ const auto &suppress_popups = demo.suppress_popups;
+ ERR_EXIT("WaitMessage() failed on paused demo", "event loop error");
+ }
+ }
+
PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE);
if (msg.message == WM_QUIT) // check for a quit message
{