Some debug infos

This commit is contained in:
JackCarterSmith 2024-09-14 16:36:15 +02:00
parent ed206fb71d
commit cb5d96c669
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
5 changed files with 1480 additions and 1 deletions

View File

@ -0,0 +1,16 @@
#include "DebugUI.hpp"
#include "../Misc/Fonts.hpp"
DebugUI::DebugUI() {
gDbgFont.loadFromMemory(&_afont_monofonto_rg, FONTSIZE_MONOFONTO_RG);
gDbgText.setFont(gDbgFont);
gDbgText.setCharacterSize(14);
gDbgText.setPosition(0, 0);
gDbgText.setFillColor(sf::Color::White);
}
void DebugUI::UpdateDebugData(std::shared_ptr<sf::RenderWindow> context) {
gDbgText.setString("CPU Usage: XXX.X % (ticks: XXXX.X ms)\nFPS: XXX\nRAM Usage: XXXX.X MB");
context->draw(gDbgText);
}

View File

@ -0,0 +1,21 @@
#pragma once
#include <memory>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
class DebugUI {
public:
DebugUI();
~DebugUI() {}
void UpdateDebugData(std::shared_ptr<sf::RenderWindow> context);
private:
sf::Font gDbgFont;
sf::Text gDbgText;
};

1439
Engine/Misc/Fonts.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,6 @@ GAME_STATUS Game::Update() {
void Game::Render() {
gMainWindow->clear();
//gDbgUI->UpdateDebugData(gMainWindow);
gDbgUI->UpdateDebugData(gMainWindow);
gMainWindow->display();
}

View File

@ -12,6 +12,7 @@ set(MISC_SCRS
Engine/Misc/Console.hpp
Engine/Misc/Logger.cpp
Engine/Misc/Logger.hpp
Engine/Misc/Fonts.hpp
)
set(GAME_SCRS
Engine/World/Arena.cpp
@ -22,6 +23,8 @@ set(GRAPHS_SCRS
Engine/Graphics/3DGraphics.cpp
Engine/Graphics/Camera.cpp
Engine/Graphics/UI.cpp
Engine/Graphics/DebugUI.cpp
Engine/Graphics/DebugUI.hpp
)
set(SOUNDS_SCRS