Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "Common.h"
  4. #include "boost/function.hpp"
  5.  
  6. using namespace std;
  7.  
  8. namespace Azura
  9. {
  10. typedef boost::function<void()> AzuraBasicCallback;
  11.  
  12. enum AzuraTimerType
  13. {
  14. Stopwatch,
  15. Countdown
  16. };
  17.  
  18. class Timer
  19. {
  20. public:
  21. Timer();
  22. Timer(AzuraTimerType type);
  23.  
  24. double TotalTime() const;
  25. double DeltaTime() const;
  26.  
  27. void Reset();
  28. void Start();
  29. void Stop();
  30.  
  31. // Countdown Specific Funcs
  32. void SetLimit(double countdownLimit);
  33.  
  34. void OnCountdownEnd(AzuraBasicCallback callback);
  35. void OnCountdownEnd(void(*callback)());
  36.  
  37. // General
  38. void Tick(void (*callback)());
  39. void Tick(AzuraBasicCallback callback);
  40.  
  41. private:
  42. double mSecondsPerTick;
  43. double mDeltaTime;
  44. AzuraTimerType mType;
  45.  
  46. void init();
  47. void processTick();
  48. void processCountdown();
  49.  
  50. AzuraBasicCallback mEventCountdownEnd;
  51.  
  52. __int64 getCurrentTime();
  53.  
  54. double mCountdownLimit;
  55. double mCurrCountdown;
  56.  
  57. __int64 mBaseTime;
  58. __int64 mPausedTime;
  59. __int64 mStopTime;
  60. __int64 mPrevTime;
  61. __int64 mCurrTime;
  62.  
  63. bool mStopped;
  64. };
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement