Version | 0.2.0 |
---|
The top-level context of a Pugl application or plugin.
The world contains all library-wide state. There is no static data in Pugl, so it is safe to use multiple worlds in a single process. This is to facilitate plugins or other situations where it is not possible to share a world, but a single world should be shared for all views where possible.
Typedefs | |
typedef struct PuglWorldImpl | PuglWorld |
Functions | |
PuglWorld * | puglNewWorld (void) |
void | puglFreeWorld (PuglWorld *world) |
void * | puglGetNativeWorld (PuglWorld *world) |
PuglStatus | puglSetClassName (PuglWorld *world, const char *name) |
double | puglGetTime (const PuglWorld *world) |
PuglStatus | puglPollEvents (PuglWorld *world, double timeout) |
PuglStatus | puglDispatchEvents (PuglWorld *world) |
typedef struct PuglWorldImpl PuglWorld |
The "world" of application state.
The world represents everything that is not associated with a particular view. Several worlds can be created in a single process, but code using different worlds must be isolated so they are never mixed. Views are strongly associated with the world they were created in.
PuglWorld* puglNewWorld | ( | void | ) |
Create a new world.
void puglFreeWorld | ( | PuglWorld * | world | ) |
Free a world allocated with puglNewWorld().
void* puglGetNativeWorld | ( | PuglWorld * | world | ) |
Return a pointer to the native handle of the world.
Display
.NULL
.HMODULE
of the calling process. PuglStatus puglSetClassName | ( | PuglWorld * | world, |
const char * | name | ||
) |
Set the class name of the application.
This is a stable identifier for the application, used as the window class/instance name on X11 and Windows. It is not displayed to the user, but can be used in scripts and by window managers, so it should be the same for every instance of the application, but different from other applications.
double puglGetTime | ( | const PuglWorld * | world | ) |
Return the time in seconds.
This is a monotonically increasing clock with high resolution. The returned time is only useful to compare against other times returned by this function, its absolute value has no meaning.
PuglStatus puglPollEvents | ( | PuglWorld * | world, |
double | timeout | ||
) |
Poll for events that are ready to be processed.
This polls for events that are ready for any view in the world, potentially blocking depending on timeout
.
world | The world to poll for events. |
timeout | Maximum time to wait, in seconds. If zero, the call returns immediately, if negative, the call blocks indefinitely. |
PuglStatus puglDispatchEvents | ( | PuglWorld * | world | ) |
Dispatch any pending events to views.
This processes all pending events, dispatching them to the appropriate views. View event handlers will be called in the scope of this call. This function does not block, if no events are pending then it will return immediately.