CUGL 2.1
Cornell University Game Library
|
#include <CUApplication.h>
Public Attributes | |
std::function< bool()> | callback |
Uint32 | period |
Uint32 | timer |
The storage type for all user-defined callbacks.
The application API provides a way for the user to attach one-time or reoccuring callback functions. This to allow the user to schedule activity in a future animation frame without having to create a separate thread. This is particularly important for functionality that accesses the OpenGL context (or any of the low-level SDL subsystems), as that must be done in the main thread.
To keep things simple, callbacks should never require arguments or return a value. If you wish to keep state, it should be done through the appropriate closure.
std::function<bool()> cugl::scheduable::callback |
The callback function
Uint32 cugl::scheduable::period |
The reoccurrence period (0 if called every frame)
Uint32 cugl::scheduable::timer |
The countdown until the next reoccurrence