blob: 66714a54eb59c06d4cb4f4bd70492425a7f7a7a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "timedLatch.hpp"
namespace ur {
TimedLatch::TimedLatch(sf::Time duration)
{
this->duration = duration;
this->clock = sf::Clock();
this->isStarted = false;
};
void
TimedLatch::start()
{
this->clock.restart();
this->isStarted = true;
};
bool
TimedLatch::is_running()
{
return this->isStarted && this->clock.getElapsedTime() < duration;
};
bool
TimedLatch::is_completed()
{
return this->isStarted && this->clock.getElapsedTime() >= duration;
};
void
TimedLatch::reset()
{
this->isStarted = false;
};
}
|