Initial commit
This commit is contained in:
commit
edfc5298e1
252 changed files with 93965 additions and 0 deletions
45
include/Spectre/Game/GameTime.h
Normal file
45
include/Spectre/Game/GameTime.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
#ifndef SPECTRE_GAME_TIME_H
|
||||
#define SPECTRE_GAME_TIME_H
|
||||
|
||||
class GameTime
|
||||
{
|
||||
public :
|
||||
GameTime(unsigned long updates_per_sec = 60);
|
||||
|
||||
void setTimeStep(unsigned long updates_per_sec);
|
||||
|
||||
double getTimeStep() const;
|
||||
|
||||
unsigned long getElapsed() const;
|
||||
|
||||
//bool shouldTick();
|
||||
|
||||
bool beginFrame();
|
||||
|
||||
bool tick();
|
||||
|
||||
void reset();
|
||||
|
||||
protected :
|
||||
|
||||
void accumulateTime();
|
||||
|
||||
void updateTime();
|
||||
|
||||
protected :
|
||||
|
||||
// TODO: min,max framerates
|
||||
|
||||
// Time(in ms) when the last update occured.
|
||||
unsigned long m_current;
|
||||
unsigned long m_lastUpdate;
|
||||
double m_acc;
|
||||
|
||||
// timeslice in ms.
|
||||
double m_slice;
|
||||
|
||||
bool m_inLoop;
|
||||
};
|
||||
|
||||
#endif /* SPECTRE_GAME_TIME_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue