PolyTimer.h 775 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "PolyGlobals.h"
  12. #include "PolyEventDispatcher.h"
  13. #include "PolyCoreServices.h"
  14. using namespace std;
  15. namespace Polycode {
  16. class _PolyExport Timer : public EventDispatcher {
  17. public:
  18. Timer(bool triggerMode, int msecs);
  19. ~Timer();
  20. void Pause(bool paused);
  21. bool isPaused();
  22. unsigned int getTicks();
  23. void Update(unsigned int ticks);
  24. void Reset();
  25. bool hasElapsed();
  26. float getElapsedf();
  27. static const int EVENT_TRIGGER = 0;
  28. private:
  29. int elapsed;
  30. bool paused;
  31. unsigned int msecs;
  32. bool triggerMode;
  33. unsigned int last;
  34. unsigned int ticks;
  35. };
  36. }