summaryrefslogtreecommitdiff
path: root/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'timer.h')
-rw-r--r--timer.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/timer.h b/timer.h
new file mode 100644
index 0000000..e580f6c
--- /dev/null
+++ b/timer.h
@@ -0,0 +1,34 @@
+#ifndef TIME_H
+#define TIME_H
+
+#include <SFML/System/Clock.hpp>
+
+class Clock {
+ private:
+ sf::Clock clock;
+ bool running;
+ float base;
+
+ public:
+ Clock();
+
+ void reset();
+ void start();
+ void stop();
+
+ float elapsed() const;
+};
+
+class Timer {
+ private:
+ const Clock& clock;
+ float starttime;
+
+ public:
+ Timer(const Clock& clock_);
+
+ void reset();
+ float elapsed() const;
+};
+
+#endif