From 816607027012de0205e144f3edd3fdcfd43db563 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Jul 2019 18:49:09 +0200 Subject: Add functions to get and set view size and position --- pugl/pugl.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'pugl/pugl.h') diff --git a/pugl/pugl.h b/pugl/pugl.h index 3639a96..1bd49bb 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -125,6 +125,19 @@ typedef enum { PUGL_TRUE = 1 /**< Explicitly true */ } PuglWindowHintValue; +/** + A rectangle. + + This is used to describe things like view position and size. Pugl generally + uses coordinates where the top left corner is 0,0. +*/ +typedef struct { + double x; + double y; + double width; + double height; +} PuglRect; + /** Keyboard modifier flags. */ @@ -539,8 +552,10 @@ puglInitWindowParent(PuglView* view, PuglNativeWindow parent); /** Set the window size before creating a window. + + @deprecated Use puglSetFrame(). */ -PUGL_API void +PUGL_API PUGL_DEPRECATED_BY("puglSetFrame") void puglInitWindowSize(PuglView* view, int width, int height); /** @@ -655,9 +670,21 @@ puglGetVisible(PuglView* view); /** Get the current size of the view. */ -PUGL_API void +PUGL_API PUGL_DEPRECATED_BY("puglGetFrame") void puglGetSize(PuglView* view, int* width, int* height); +/** + Get the current position and size of the view. +*/ +PUGL_API PuglRect +puglGetFrame(const PuglView* view); + +/** + Set the current position and size of the view. +*/ +PUGL_API PuglStatus +puglSetFrame(PuglView* view, PuglRect frame); + /** @name Context Functions for accessing the drawing context. -- cgit v1.2.1