-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFPSCounter.h
More file actions
36 lines (28 loc) · 878 Bytes
/
FPSCounter.h
File metadata and controls
36 lines (28 loc) · 878 Bytes
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
#pragma once
#include <vector>
#include <chrono>
class FPSCounter
{
public:
FPSCounter(int samplingFrame);
~FPSCounter();
void Update();
int GetCountingFrame() const { return _countingFrame; }
double GetFPS() const { return _avarageFPS; }
static double GetDeltaTime() { return _deltaTime; }
private:
//移動平均を適用するフレーム数
int _samplingFrame;
//計測開始から今までのフレーム数
int _countingFrame;
//表示するFPS
long double _avarageFPS;
//毎フレーム分カウントした値の総和
long double _totalTime;
//前フレームからの経過時間
static long double _deltaTime;
//前フレームでの時刻
std::chrono::system_clock::time_point _beforeTime;
//現在フレームでの時刻
std::chrono::system_clock::time_point _currentTime;
};