PolyTimer.h 800 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * PolyTimer.h
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 5/18/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package BasicTypes
  10. #pragma once
  11. #include "PolyString.h"
  12. #include "PolyGlobals.h"
  13. #include "PolyEventDispatcher.h"
  14. #include "PolyCoreServices.h"
  15. using namespace std;
  16. namespace Polycode {
  17. class _PolyExport Timer : public EventDispatcher {
  18. public:
  19. Timer(bool triggerMode, int msecs);
  20. ~Timer();
  21. void Pause(bool paused);
  22. bool isPaused();
  23. unsigned int getTicks();
  24. void Update(unsigned int ticks);
  25. void Reset();
  26. bool hasElapsed();
  27. Number getElapsedf();
  28. static const int EVENT_TRIGGER = 0;
  29. private:
  30. int elapsed;
  31. bool paused;
  32. unsigned int msecs;
  33. bool triggerMode;
  34. unsigned int last;
  35. unsigned int ticks;
  36. };
  37. }