mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-05 00:33:51 +00:00
Initial commit: wowee native WoW 3.3.5a client
This commit is contained in:
commit
ce6cb8f38e
147 changed files with 32347 additions and 0 deletions
100
include/rendering/performance_hud.hpp
Normal file
100
include/rendering/performance_hud.hpp
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
||||
namespace wowee {
|
||||
|
||||
namespace rendering {
|
||||
class Renderer;
|
||||
class Camera;
|
||||
}
|
||||
|
||||
namespace rendering {
|
||||
|
||||
/**
|
||||
* Performance HUD for displaying real-time statistics
|
||||
*
|
||||
* Shows FPS, frame time, rendering stats, and terrain info
|
||||
*/
|
||||
class PerformanceHUD {
|
||||
public:
|
||||
PerformanceHUD();
|
||||
~PerformanceHUD();
|
||||
|
||||
/**
|
||||
* Update HUD with latest frame time
|
||||
* @param deltaTime Time since last frame in seconds
|
||||
*/
|
||||
void update(float deltaTime);
|
||||
|
||||
/**
|
||||
* Render HUD using ImGui
|
||||
* @param renderer Renderer for accessing stats
|
||||
* @param camera Camera for position info
|
||||
*/
|
||||
void render(const Renderer* renderer, const Camera* camera);
|
||||
|
||||
/**
|
||||
* Enable/disable HUD display
|
||||
*/
|
||||
void setEnabled(bool enabled) { this->enabled = enabled; }
|
||||
bool isEnabled() const { return enabled; }
|
||||
|
||||
/**
|
||||
* Toggle HUD visibility
|
||||
*/
|
||||
void toggle() { enabled = !enabled; }
|
||||
|
||||
/**
|
||||
* Set HUD position
|
||||
*/
|
||||
enum class Position {
|
||||
TOP_LEFT,
|
||||
TOP_RIGHT,
|
||||
BOTTOM_LEFT,
|
||||
BOTTOM_RIGHT
|
||||
};
|
||||
void setPosition(Position pos) { position = pos; }
|
||||
|
||||
/**
|
||||
* Enable/disable specific sections
|
||||
*/
|
||||
void setShowFPS(bool show) { showFPS = show; }
|
||||
void setShowRenderer(bool show) { showRenderer = show; }
|
||||
void setShowTerrain(bool show) { showTerrain = show; }
|
||||
void setShowCamera(bool show) { showCamera = show; }
|
||||
void setShowControls(bool show) { showControls = show; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Calculate average FPS from frame time history
|
||||
*/
|
||||
void calculateFPS();
|
||||
|
||||
bool enabled = true; // Enabled by default, press F1 to toggle
|
||||
Position position = Position::TOP_LEFT;
|
||||
|
||||
// Section visibility
|
||||
bool showFPS = true;
|
||||
bool showRenderer = true;
|
||||
bool showTerrain = true;
|
||||
bool showCamera = true;
|
||||
bool showControls = true;
|
||||
|
||||
// FPS tracking
|
||||
std::deque<float> frameTimeHistory;
|
||||
static constexpr size_t MAX_FRAME_HISTORY = 120; // 2 seconds at 60 FPS
|
||||
float currentFPS = 0.0f;
|
||||
float averageFPS = 0.0f;
|
||||
float minFPS = 0.0f;
|
||||
float maxFPS = 0.0f;
|
||||
float frameTime = 0.0f;
|
||||
|
||||
// Update timing
|
||||
float updateTimer = 0.0f;
|
||||
static constexpr float UPDATE_INTERVAL = 0.1f; // Update stats every 0.1s
|
||||
};
|
||||
|
||||
} // namespace rendering
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue