aboutsummaryrefslogtreecommitdiff
path: root/examples/pugl_cairo_demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pugl_cairo_demo.c')
-rw-r--r--examples/pugl_cairo_demo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c
index d2e57f8..a1423ae 100644
--- a/examples/pugl_cairo_demo.c
+++ b/examples/pugl_cairo_demo.c
@@ -203,6 +203,11 @@ onEvent(PuglView* view, const PuglEvent* event)
app->entered = false;
puglPostRedisplay(view);
break;
+ case PUGL_UPDATE:
+ if (app->opts.continuous) {
+ puglPostRedisplay(view);
+ }
+ break;
case PUGL_EXPOSE:
onDisplay(app, view, &event->expose);
break;
@@ -249,14 +254,9 @@ main(int argc, char** argv)
puglShowWindow(view);
PuglFpsPrinter fpsPrinter = { puglGetTime(app.world) };
+ const double timeout = app.opts.continuous ? (1 / 60.0) : -1.0;
while (!app.quit) {
- if (app.opts.continuous) {
- postButtonRedisplay(view);
- } else {
- puglPollEvents(app.world, -1);
- }
-
- puglDispatchEvents(app.world);
+ puglUpdate(app.world, timeout);
if (app.opts.continuous) {
puglPrintFps(app.world, &fpsPrinter, &app.framesDrawn);