diff options
author | David Robillard <d@drobilla.net> | 2019-07-22 16:30:53 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-09-03 08:32:16 +0200 |
commit | e83c2b421d140244a6b9edb051b3e0d4aacda332 (patch) | |
tree | 398e49f43c96f4602496874fa7b3680236138720 /test | |
parent | 5081d49f9f08596c07a8ed32430a4fa3e1baf352 (diff) |
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')
-rw-r--r-- | test/pugl_cairo_test.c | 6 | ||||
-rw-r--r-- | test/pugl_test.c | 29 |
2 files changed, 21 insertions, 14 deletions
diff --git a/test/pugl_cairo_test.c b/test/pugl_cairo_test.c index a16c821..3cdf904 100644 --- a/test/pugl_cairo_test.c +++ b/test/pugl_cairo_test.c @@ -202,7 +202,8 @@ main(int argc, char** argv) } } - PuglView* view = puglInit(NULL, NULL); + PuglWorld* world = puglNewWorld(); + PuglView* view = puglNewView(world); puglInitWindowClass(view, "PuglCairoTest"); puglInitWindowSize(view, 512, 512); puglInitWindowMinSize(view, 256, 256); @@ -233,6 +234,7 @@ main(int argc, char** argv) } } - puglDestroy(view); + puglFreeView(view); + puglFreeWorld(world); return 0; } 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; } |