summary refs log tree commit diff stats
path: root/src/timer.h
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-03-12 09:05:21 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2022-03-12 09:05:21 -0500
commitde7ee5ef022a8ccaece0ea5f5402adedeafe36b4 (patch)
treec51e6d7c71f1e0fb13cbccf05895b7950750a09b /src/timer.h
parent6cfc54f019ea793c75c012af9c8249eac936cfac (diff)
downloadether-de7ee5ef022a8ccaece0ea5f5402adedeafe36b4.tar.gz
ether-de7ee5ef022a8ccaece0ea5f5402adedeafe36b4.tar.bz2
ether-de7ee5ef022a8ccaece0ea5f5402adedeafe36b4.zip
added back bump sound (and assets for fuller music)
Diffstat (limited to 'src/timer.h')
-rw-r--r--src/timer.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/timer.h b/src/timer.h new file mode 100644 index 0000000..ec34f3e --- /dev/null +++ b/src/timer.h
@@ -0,0 +1,32 @@
1#ifndef TIMER_H_45E2F1F9
2#define TIMER_H_45E2F1F9
3
4class Timer {
5public:
6
7 Timer(int dt) : dt_(dt) {}
8
9 void accumulate(int t) {
10 acc_ += t;
11 }
12
13 bool step() {
14 if (acc_ > dt_) {
15 acc_ -= dt_;
16 return true;
17 } else {
18 return false;
19 }
20 }
21
22 void reset() {
23 acc_ = 0;
24 }
25
26private:
27
28 int dt_;
29 int acc_ = 0;
30};
31
32#endif /* end of include guard: TIMER_H_45E2F1F9 */