aboutsummaryrefslogtreecommitdiffstats
path: root/test/pugl_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-22 16:30:53 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:32:16 +0200
commite83c2b421d140244a6b9edb051b3e0d4aacda332 (patch)
tree398e49f43c96f4602496874fa7b3680236138720 /test/pugl_test.c
parent5081d49f9f08596c07a8ed32430a4fa3e1baf352 (diff)
downloadpugl-e83c2b421d140244a6b9edb051b3e0d4aacda332.tar.gz
pugl-e83c2b421d140244a6b9edb051b3e0d4aacda332.tar.bz2
pugl-e83c2b421d140244a6b9edb051b3e0d4aacda332.zip
Add PuglWorld
The old API was broken for programs that manage multiple views, since it was impossible to wait for events on any view. There are also several functions in the API which are not actually associated with views at all, so those can now be moved to the more appropriate PuglWorld to make this more clear. The old puglInit() and puglDestroy() functions are preserved for compatibility, but marked as deprecated.
Diffstat (limited to 'test/pugl_test.c')
-rw-r--r--test/pugl_test.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/pugl_test.c b/test/pugl_test.c
index b8a0a42..b012868 100644
--- a/test/pugl_test.c
+++ b/test/pugl_test.c
@@ -34,16 +34,17 @@
typedef struct
{
- bool continuous;
- int quit;
- float xAngle;
- float yAngle;
- float dist;
- double lastMouseX;
- double lastMouseY;
- double lastDrawTime;
- unsigned framesDrawn;
- bool mouseEntered;
+ PuglWorld* world;
+ bool continuous;
+ int quit;
+ float xAngle;
+ float yAngle;
+ float dist;
+ double lastMouseX;
+ double lastMouseY;
+ double lastDrawTime;
+ unsigned framesDrawn;
+ bool mouseEntered;
} PuglTestApp;
static void
@@ -178,7 +179,9 @@ main(int argc, char** argv)
}
}
- PuglView* view = puglInit(NULL, NULL);
+ app.world = puglNewWorld();
+
+ PuglView* view = puglNewView(app.world);
puglInitWindowClass(view, "PuglTest");
puglInitWindowSize(view, 512, 512);
puglInitWindowMinSize(view, 256, 256);
@@ -224,6 +227,8 @@ main(int argc, char** argv)
}
}
- puglDestroy(view);
+ puglFreeView(view);
+ puglFreeWorld(app.world);
+
return 0;
}