22 #ifndef QDENGINE_QDCORE_UTIL_SYNCRO_TIMER 23 #define QDENGINE_QDCORE_UTIL_SYNCRO_TIMER 25 #include "common/system.h" 27 typedef uint32 time_type;
34 time_type operator()()
const {
38 time_type delta()
const {
39 return _time - _time_prev;
44 _time_prev = _time = 1;
49 void set(
int syncro_by_clock, time_type time_per_frame, time_type max_time_interval) {
50 _syncro_by_clock = syncro_by_clock;
51 _time_per_frame = time_per_frame;
52 _max_time_interval = max_time_interval;
58 if (_syncro_by_clock) {
60 float dt = (t - _time - _time_offset) * _time_speed;
61 if (dt > _max_time_interval)
62 dt = _max_time_interval;
64 _time_offset = t - _time;
74 _time += _time_per_frame * _time_speed;
84 void setTime(time_type t) {
85 _time_prev = _time = t;
89 void setSpeed(
float speed) {
97 time_type _max_time_interval;
98 time_type _time_per_frame;
105 #endif // QDENGINE_QDCORE_UTIL_SYNCRO_TIMER virtual uint32 getMillis(bool skipRecord=false)=0
Definition: SynchroTimer.h:31
Базовый класс для игровых ресурсов.
Definition: console.h:28