Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
FrameRateHandler.h
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#pragma once
33#ifndef DVD_CORE_TIME_FRAMERATE_HANDLER_H_
34#define DVD_CORE_TIME_FRAMERATE_HANDLER_H_
35
36namespace Divide {
37namespace Time {
39 static constexpr U32 FRAME_AVG_DELAY_COUNT = 5;
40 static constexpr U32 FRAME_ARRAY_SIZE = 120;
41 static constexpr U32 FRAME_AVG_RESET_COUNT = 60 * 5;
42
43public:
44 void tick(U64 deltaTimeUS) noexcept;
45
46 [[nodiscard]] inline F32 minFrameRate() const noexcept;
47 [[nodiscard]] inline F32 maxFrameRate() const noexcept;
48 [[nodiscard]] inline F32 frameRate() const noexcept;
49 [[nodiscard]] inline F32 frameTime() const noexcept;
50 [[nodiscard]] inline F32 averageFrameRate() const noexcept;
51 inline void frameRateAndTime(F32& fpsOut, F32& frameTimeOut) const noexcept;
52 inline void frameStates(F32& avgFPSOut, F32& minFPSOut, F32& maxFPSOut) const noexcept;
53
54private:
64};
65
66} //namespace Time
67} //namespace Divide
68
69#endif //DVD_CORE_TIME_FRAMERATE_HANDLER_H_
70
71#include "FrameRateHandler.inl"
void frameRateAndTime(F32 &fpsOut, F32 &frameTimeOut) const noexcept
static constexpr U32 FRAME_ARRAY_SIZE
void tick(U64 deltaTimeUS) noexcept
F32 averageFrameRate() const noexcept
F32 minFrameRate() const noexcept
F32 maxFrameRate() const noexcept
void frameStates(F32 &avgFPSOut, F32 &minFPSOut, F32 &maxFPSOut) const noexcept
static constexpr U32 FRAME_AVG_DELAY_COUNT
static constexpr U32 FRAME_AVG_RESET_COUNT
std::array< F32, FRAME_ARRAY_SIZE > _framerateSecPerFrame
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
int32_t I32
constexpr F32 F32_LOWEST
constexpr F32 F32_MAX
uint32_t U32
uint64_t U64