CUGL 2.3
Cornell University Game Library
No Matches
Public Attributes | List of all members
cugl::scheduable Struct Reference

#include <CUApplication.h>

Public Attributes

std::function< bool()> callback
Uint32 period
Uint32 timer

Detailed Description

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.

Member Data Documentation

◆ callback

std::function<bool()> cugl::scheduable::callback

The callback function

◆ period

Uint32 cugl::scheduable::period

The reoccurrence period (0 if called every frame)

◆ timer

Uint32 cugl::scheduable::timer

The countdown until the next reoccurrence

The documentation for this struct was generated from the following file: