geTimer
From GriffinEngine
geTimer has two main purposes:
1) The static parts of geTimer provide information about time in the game. Methods such as geTimer::getTime() and geTimer::getFPS() can be called from anywhere. 2) The member parts of geTimer provide functionality for setting up alarms/timeouts/timers. To start an alarm, create a new geTimer() object and specify the duration. When the time is up, geTimerEvent's are created by the geEventManager.
NOTE: several different time formats are available in some methods. For absolute-time functions: a) the familiar unix timestamp (time_c): getTime() b) number of seconds (double) since system startup (*D suffix): getTimeD() c) number of OS ticks (time_c) since system startup (*T suffix): getTimeT() For most relative-time functions, seconds (double) are used.
Contents
[hide]Inheritance
Base classes
- geObject
- geTimer
Reference
Constructors
geTimer( double _duration, bool autostart=true ); // creates new alarm
Static Methods
static double getFrameDuration(); // last frame's duration, seconds
static float getFrameDurationf(); // last frame's duration, seconds [float]
static double getFPS(); // number of frames-per-seconds based on last frame
static double getTotalTime(); // time since game start, seconds
static UINT getTotalTicks(); // ticks (rendered frames) since game start
static time_t getTime(); // current timestamp, UNIX timestamp
static double getTimeD(); // current timestamp, OS seconds
static time_t getTimeT(); // current timestamp, OS ticks
static time_t getStartupTime(); // timestamp of game startup, UNIX timestamp
static double getStartupTimeD(); // timestamp of game startup, OS seconds
static time_t getStartupTimeT(); // timestamp of game startup, OS ticks
Instance (Alarm) Methods
bool isActive() const; // returns true if alarm is active
time_t getStartTime() const; // timestamp of start time, UNIX timestamp
double getStartTimeD() const; // timestamp of start time, OS seconds
time_t getStartTimeT() const; // timestamp of start time, OS ticks
time_t getEndTime() const; // timestamp of end time, UNIX timestamp
double getEndTimeD() const; // timestamp of end time, OS seconds
time_t getEndTimeT() const; // timestamp of end time, OS ticks
double getElapsedTime() const; // elapsed time, seconds
double getRemainingTime() const; // remaining time, seconds
double getDuration() const; // alarm duration, seconds
void Reset(); // reset alarm to original duration (NOTE: does not deactivate)
void Stop(); // deactivate the alarm (NOTE: does not reset duration)
void Start(); // (re)activate the alarm
Events |
---|
geEventManager · geKeyboard · geMouse · geTimer |
geCollisionEvent · GeKeyEvent · GeMouseClickEvent · GeMouseDragEvent · GeMouseMotionEvent |