vengine
0.1.0
3D graphics engine made with Vulkan
Loading...
Searching...
No Matches
FrameCounter.hpp
Go to the documentation of this file.
1
///
2
/// @file FrameCounter.hpp
3
/// @brief This file contains the FrameCounter class
4
/// @namespace ven
5
///
6
7
#pragma once
8
9
#include <iostream>
10
11
namespace
ven
{
12
13
class
FrameCounter
{
14
15
public
:
16
17
FrameCounter
() =
default
;
18
~FrameCounter
() =
default
;
19
20
void
update
(
const
float
deltaTime) {
21
m_frameCounter
+= 1.F;
22
m_timeCounter
+= deltaTime;
23
24
if
(
m_timeCounter
>= 1.F) {
25
std::cout <<
"FPS: "
<<
m_frameCounter
<<
'\n'
;
26
m_fps
=
m_frameCounter
;
27
m_frameTime
= 1000.F /
m_fps
;
28
m_frameCounter
= 0.F;
29
m_timeCounter
= 0.F;
30
}
31
}
32
33
[[nodiscard]]
float
getFps
()
const
{
return
m_fps
; }
34
[[nodiscard]]
float
getFrameTime
()
const
{
return
m_frameTime
; }
35
36
private
:
37
38
float
m_fps
{0.F};
39
float
m_frameTime
{0.F};
40
float
m_frameCounter
{0.F};
41
float
m_timeCounter
{0.F};
42
43
};
// class FrameCounter
44
45
}
// namespace ven
ven::FrameCounter
Definition
FrameCounter.hpp:13
ven::FrameCounter::m_frameTime
float m_frameTime
Definition
FrameCounter.hpp:39
ven::FrameCounter::~FrameCounter
~FrameCounter()=default
ven::FrameCounter::update
void update(const float deltaTime)
Definition
FrameCounter.hpp:20
ven::FrameCounter::m_frameCounter
float m_frameCounter
Definition
FrameCounter.hpp:40
ven::FrameCounter::getFrameTime
float getFrameTime() const
Definition
FrameCounter.hpp:34
ven::FrameCounter::FrameCounter
FrameCounter()=default
ven::FrameCounter::getFps
float getFps() const
Definition
FrameCounter.hpp:33
ven::FrameCounter::m_fps
float m_fps
Definition
FrameCounter.hpp:38
ven::FrameCounter::m_timeCounter
float m_timeCounter
Definition
FrameCounter.hpp:41
ven
include
VEngine
FrameCounter.hpp
Generated by
1.11.0