Performance check showed that I was checking every sprite even if they're way far away so now just do ones near-ish.

This commit is contained in:
Zed A. Shaw 2025-02-25 00:56:54 -05:00
parent 29e6d45dc6
commit 5179709e3c
7 changed files with 13 additions and 13 deletions

View file

@ -6,7 +6,6 @@ namespace gui {
MainUI::MainUI(sf::RenderWindow& window) :
$window(window),
$overlay_ui($level),
$rayview(RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT)
{
$window.setVerticalSyncEnabled(VSYNC);
@ -37,6 +36,7 @@ namespace gui {
void MainUI::draw_stats() {
auto player = $level.world->get_the<Player>();
auto player_combat = $level.world->get<Combat>(player.entity);
auto map = $level.map;
std::string stats = fmt::format("STATS\n"
"HP: {}\n"
"mean:{:>8.5}\n"
@ -44,12 +44,13 @@ namespace gui {
"min: {:>8.5}\n"
"max: {:>8.5}\n"
"count:{:<10}\n\n"
"level: {} size: {}x{}\n\n"
"VSync? {}\n"
"FR Limit: {}\n"
"Debug? {}\n\n",
player_combat.hp, $stats.mean(), $stats.stddev(), $stats.min,
$stats.max, $stats.n, VSYNC,
FRAME_LIMIT, DEBUG_BUILD);
$stats.max, $stats.n, $level.index, map->width(), map->height(),
VSYNC, FRAME_LIMIT, DEBUG_BUILD);
$overlay_ui.update_text("top_left", stats);
}