Flutter Engine
The Flutter Engine
|
#include <AnimTimer.h>
Public Types | |
enum | State { kStopped_State , kPaused_State , kRunning_State } |
Public Member Functions | |
AnimTimer () | |
State | state () const |
double | nanos () const |
float | getSpeed () const |
void | setSpeed (float speed) |
void | run () |
void | pause () |
void | togglePauseResume () |
void | updateTime () |
Class to track a "timer". It supports 3 states: stopped, paused, and running. Playback speed is variable.
The caller must call updateTime() to resync with the clock (typically just before using the timer). Forcing the caller to do this ensures that the timer's return values are consistent if called repeatedly, as they only reflect the time since the last calle to updateTimer().
Definition at line 23 of file AnimTimer.h.
enum AnimTimer::State |
|
inline |
|
inline |
Control the rate at which time advances.
Definition at line 39 of file AnimTimer.h.
|
inline |
Definition at line 34 of file AnimTimer.h.
|
inline |
Definition at line 59 of file AnimTimer.h.
|
inline |
If the timer is paused or stopped, it will resume (or start if it was stopped).
Definition at line 45 of file AnimTimer.h.
|
inline |
Definition at line 40 of file AnimTimer.h.
|
inline |
Definition at line 32 of file AnimTimer.h.
|
inline |
If the timer is stopped, start running, else it toggles between paused and running.
Definition at line 68 of file AnimTimer.h.
|
inline |
Call this each time you want to sample the clock for the timer. This is NOT done automatically, so that repeated calls to msec() or secs() will always return the same value.
This may safely be called with the timer in any state.
Definition at line 83 of file AnimTimer.h.