-
Notifications
You must be signed in to change notification settings - Fork 0
/
timer.h
39 lines (29 loc) · 818 Bytes
/
timer.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
#ifndef TIMER_H
#define TIMER_H
#include <GLFW/glfw3.h>
/*
* The Timer class provides functions to measure the time between frames as well as the total passed time of animation
*/
class Timer{
public:
// startin frame
float frame_start;
// current frame
float frame_current;
// last frame
float frame_last;
// time between last frame and current
float time_delta;
// time between last frame and start of animation
float time_total;
// default constructor
Timer(){
}
// mark start of timer
void start(){
frame_start = static_cast<float>(glfwGetTime());
}
// measure time between frames as well as total time passed
void measure();
};
#endif