Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Common.h"
- #include "boost/function.hpp"
- using namespace std;
- namespace Azura
- {
- typedef boost::function<void()> AzuraBasicCallback;
- enum AzuraTimerType
- {
- Stopwatch,
- Countdown
- };
- class Timer
- {
- public:
- Timer();
- Timer(AzuraTimerType type);
- double TotalTime() const;
- double DeltaTime() const;
- void Reset();
- void Start();
- void Stop();
- // Countdown Specific Funcs
- void SetLimit(double countdownLimit);
- void OnCountdownEnd(AzuraBasicCallback callback);
- void OnCountdownEnd(void(*callback)());
- // General
- void Tick(void (*callback)());
- void Tick(AzuraBasicCallback callback);
- private:
- double mSecondsPerTick;
- double mDeltaTime;
- AzuraTimerType mType;
- void init();
- void processTick();
- void processCountdown();
- AzuraBasicCallback mEventCountdownEnd;
- __int64 getCurrentTime();
- double mCountdownLimit;
- double mCurrCountdown;
- __int64 mBaseTime;
- __int64 mPausedTime;
- __int64 mStopTime;
- __int64 mPrevTime;
- __int64 mCurrTime;
- bool mStopped;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement