Setup¶
Functions for creating and destroying a view.
-
PuglView *puglNewView(PuglWorld *world)¶
Create a new view.
A newly created view does not correspond to a real system view or window. It must first be configured, then the system view can be created with
puglRealize()
.
-
void puglFreeView(PuglView *view)¶
Free a view created with
puglNewView()
-
void puglSetHandle(PuglView *view, PuglHandle handle)¶
Set the user data for a view.
This is usually a pointer to a struct that contains all the state which must be accessed by a view. Everything needed to process events should be stored here, not in static variables.
The handle is opaque to Pugl and is not interpreted in any way.
-
PuglHandle puglGetHandle(PuglView *view)¶
Get the user data for a view.
-
PuglStatus puglSetBackend(PuglView *view, const PuglBackend *backend)¶
Set the graphics backend to use for a view.
This must be called once to set the graphics backend before calling
puglRealize()
.Pugl includes the following backends:
Note that backends are modular and not compiled into the main Pugl library to avoid unnecessary dependencies. To use a particular backend, applications must link against the appropriate backend library, or be sure to compile in the appropriate code if using a local copy of Pugl.
-
PuglStatus puglSetEventFunc(PuglView *view, PuglEventFunc eventFunc)¶
Set the function to call when an event occurs.
-
PuglStatus puglSetViewHint(PuglView *view, PuglViewHint hint, int value)¶
Set a hint to configure view properties.
This only has an effect when called before
puglRealize()
.
-
int puglGetViewHint(const PuglView *view, PuglViewHint hint)¶
Get the value for a view hint.
If the view has been realized, this can be used to get the actual value of a hint which was initially set to PUGL_DONT_CARE, or has been adjusted from the suggested value.