When writing the X11 (linux) implementation there was a problem with X11 defining a "Display" type and we also have a Display class in the engine. So to fix that problem and minimize the risk for running into other name conflicts. We move everything from global namespace.
49 lines
No EOL
672 B
C++
49 lines
No EOL
672 B
C++
|
|
#ifndef SPECTRE_GAME_TIME_H
|
|
#define SPECTRE_GAME_TIME_H
|
|
|
|
namespace sp {
|
|
|
|
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;
|
|
};
|
|
|
|
} // namespace sp
|
|
|
|
#endif /* SPECTRE_GAME_TIME_H */ |