-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock.h
47 lines (40 loc) · 897 Bytes
/
clock.h
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
39
40
41
42
43
44
45
46
47
#ifndef CLOCK__H
#define CLOCK__H
#include <SDL.h>
#include <string>
#include <iostream>
#include <fstream>
class Manager;
class Introduction;
class Clock {
public:
static Clock& getInstance();
unsigned getTicks() const;
private:
friend class Manager;
friend class Introduction;
unsigned getElapsedTicks();
Clock& operator++();
Clock operator++(int);
bool isStarted() const { return started; }
bool isPaused() const { return paused; }
unsigned getFrames() const { return frames; }
unsigned getSeconds() const { return getTicks()/1000; }
int getFps() const;
void start();
void pause();
void unpause();
void debug();
bool started;
bool paused;
unsigned frames;
unsigned timeAtStart;
unsigned timeAtPause;
unsigned currTicks;
unsigned prevTicks;
unsigned ticks;
Clock();
Clock(const Clock&);
Clock&operator=(const Clock&);
};
#endif