summaryrefslogtreecommitdiff
path: root/time.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-01-29 19:47:44 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-01-29 19:47:44 +0100
commite14b2f145ee43a652d71f53e3f645c58bb7b8e6f (patch)
tree0775db4b211858b3464cfc24413e8d9599e13979 /time.h
parentf94354c1b5c02be567ebd376adfc720af6ec1b8f (diff)
Added Clock and Timer.
Diffstat (limited to 'time.h')
-rw-r--r--time.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/time.h b/time.h
new file mode 100644
index 0000000..e580f6c
--- /dev/null
+++ b/time.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