From eccb6df404b9ae052b9d13750f54dc69241668b4 Mon Sep 17 00:00:00 2001 From: Stephen Enders Date: Wed, 20 Jan 2021 21:05:44 -0500 Subject: Create timer and use it to end the rolling phase This timer can be used to determine when to end rolling --- timedLatch.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 timedLatch.hpp (limited to 'timedLatch.hpp') diff --git a/timedLatch.hpp b/timedLatch.hpp new file mode 100644 index 0000000..77c7d49 --- /dev/null +++ b/timedLatch.hpp @@ -0,0 +1,22 @@ +#ifndef UR_TIMEDLATCH_H +#define UR_TIMEDLATCH_H +#include + +namespace ur { +class TimedLatch +{ +public: + TimedLatch(sf::Time duration); + void start(); + void reset(); + bool is_running(); + bool is_completed(); + +private: + bool isStarted; + sf::Time duration; + sf::Clock clock; // internal sfml clock to manage time +}; +} + +#endif -- cgit v1.2.3-54-g00ecf