sculpto
profiller_window.cpp
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file profiller_window.cpp
3 * \brief Application profiller GUI window class implementation module.
4 *
5 * \author Sabitov Kirill
6 * \date 09 July 2022
7 *********************************************************************/
8
9#include "sclpch.h"
10
11#include <imgui.h>
12
13#include "profiller_window.h"
16
18{
19 FPSPlotUpdateDelay += timer::GetDeltaTime();
20 if (FPSPlotUpdateDelay > timer::UpdateDelay)
21 {
22 if (FPSList.size() > 50) FPSList.erase(FPSList.begin());
23 FPSList.push_back(timer::GetFps());
24 FPSPlotUpdateDelay = 0;
25 }
26
27 ImGui::Begin("Profiller");
28 {
29 ImGui::Text("Average framerate %.1f FPS", timer::GetFps());
30 ImGui::PlotLines("", FPSList.data(), (u32)FPSList.size(), 0, 0, FLT_MAX, FLT_MAX, { ImGui::GetWindowWidth() - 15.0f, ImGui::GetWindowHeight() - 56.0f });
31 }
32 ImGui::End();
33}
static const float UpdateDelay
Definition: timer.h:35
static float GetFps()
Definition: timer.h:44
static float GetDeltaTime()
Definition: timer.h:42
uint32_t u32
Definition: math_common.h:21
Application profiller GUI window class definition module.
Render bridge class implementation module. Static class for making calls to low-level render api,...
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.
Timer, calculating interframe deltatime and fps class implementation module.