From 6b4a5a128ef5d87374dfef017cd20e069c068a4b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Sep 2015 15:22:49 -0400 Subject: Add support for aspect ratio constraints. Currently only implemented on X11. --- pugl/pugl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pugl/pugl.h') diff --git a/pugl/pugl.h b/pugl/pugl.h index 53115ff..3ff66f9 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -170,6 +170,19 @@ puglInitWindowSize(PuglView* view, int width, int height); PUGL_API void puglInitWindowMinSize(PuglView* view, int width, int height); +/** + Set the window aspect ratio range before creating a window. + + The x and y values here represent a ratio of width to height. To set a + fixed aspect ratio, set the minimum and maximum values to the same ratio. +*/ +PUGL_API void +puglInitWindowAspectRatio(PuglView* view, + int min_x, + int min_y, + int max_x, + int max_y); + /** Enable or disable resizing before creating a window. */ -- cgit v1.2.3 From 809ead2220f5a9ed66f88b1ae84a93e334e2717f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Sep 2015 19:45:02 -0400 Subject: Add puglWaitForEvent for blocking main loops. --- pugl/pugl.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pugl/pugl.h') diff --git a/pugl/pugl.h b/pugl/pugl.h index 3ff66f9..8dca956 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -361,11 +361,23 @@ puglSetReshapeFunc(PuglView* view, PuglReshapeFunc reshapeFunc); PUGL_API void puglGrabFocus(PuglView* view); +/** + Block and wait for an event to be ready. + + This can be used in a loop to only process events via puglProcessEvents when + necessary. This function will block indefinitely if no events are + available, so is not appropriate for use in programs that need to perform + regular updates (e.g. animation). +*/ +PUGL_API PuglStatus +puglWaitForEvent(PuglView* view); + /** Process all pending window events. This handles input events as well as rendering, so it should be called - regularly and rapidly enough to keep the UI responsive. + regularly and rapidly enough to keep the UI responsive. This function does + not block if no events are pending. */ PUGL_API PuglStatus puglProcessEvents(PuglView* view); -- cgit v1.2.3 From 6abce4944cb49c65dd1d592be45b766110dbfeba Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Sep 2015 19:51:03 -0400 Subject: Update copyright dates. --- pugl/pugl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pugl/pugl.h') diff --git a/pugl/pugl.h b/pugl/pugl.h index 8dca956..074297c 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -1,5 +1,5 @@ /* - Copyright 2012-2014 David Robillard + Copyright 2012-2015 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above -- cgit v1.2.3