Clock.h 930 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "oxygine-include.h"
  3. #include "core/Object.h"
  4. namespace oxygine
  5. {
  6. DECLARE_SMART(Clock, spClock);
  7. class Clock: public Object
  8. {
  9. public:
  10. Clock();
  11. ~Clock();
  12. timeMS getTime() const;
  13. int getPauseCounter() const;
  14. int getFixedStep() const;
  15. int getLastDT() const;
  16. timeMS getLastUpdateTime() const;
  17. float getMultiplier() const;
  18. void setFixedStep(float stepMS);
  19. void setMultiplier(float m);
  20. void pause();
  21. void resume();
  22. void resetPause();
  23. void update(timeMS globalTime = -1);
  24. timeMS doTick();
  25. std::string dump() const;
  26. private:
  27. int _counter;
  28. double _destTime;
  29. double _srcTime;
  30. float _multiplier;
  31. float _fixedStep;
  32. int _lastDT;
  33. timeMS _lastUpdateTime;
  34. };
  35. }