Converted almost everything to use wstring so that it works better with SFML and the unicode/utf8 usage in the system.

This commit is contained in:
Zed A. Shaw 2025-03-28 12:40:46 -04:00
parent 47c6bfd531
commit 72951f308f
17 changed files with 156 additions and 162 deletions

View file

@ -1,6 +1,7 @@
#include "main_ui.hpp"
#include "components.hpp"
#include "easings.hpp"
#include <fmt/xchar.h>
namespace gui {
using namespace components;
@ -27,7 +28,7 @@ namespace gui {
auto player = $level.world->get_the<Player>();
auto& player_combat = $level.world->get<Combat>(player.entity);
player_combat.hp = player_combat.max_hp;
$overlay_ui.show_text("top_left", "STATS");
$overlay_ui.show_text("top_left", L"STATS");
} else {
// it's off now, close it
$overlay_ui.close_text("top_left");
@ -38,18 +39,18 @@ namespace gui {
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"
"sdev: {:>8.5}\n"
"min: {:>8.5}\n"
"max: {:>8.5}\n"
"count:{:<10}\n"
"level: {} size: {}x{}\n\n"
"dir: {:0.2},{:0.2}\n\n"
"VSync? {}\n"
"FR Limit: {}\n"
"Debug? {}\n\n",
std::wstring stats = fmt::format(L"STATS\n"
L"HP: {}\n"
L"mean:{:>8.5}\n"
L"sdev: {:>8.5}\n"
L"min: {:>8.5}\n"
L"max: {:>8.5}\n"
L"count:{:<10}\n"
L"level: {} size: {}x{}\n\n"
L"dir: {:0.2},{:0.2}\n\n"
L"VSync? {}\n"
L"FR Limit: {}\n"
L"Debug? {}\n\n",
player_combat.hp, $stats.mean(), $stats.stddev(), $stats.min,
$stats.max, $stats.n, $level.index, map->width(), map->height(),
$rayview.$dir_x, $rayview.$dir_y,
@ -103,7 +104,7 @@ namespace gui {
st.sprite->setScale({scale, scale});
$window.draw(*st.sprite);
$overlay_ui.show_label("middle", "INTO THE WELL YOU GO...");
$overlay_ui.show_label("middle", L"INTO THE WELL YOU GO...");
} else {
if($needs_render) $rayview.render();
$rayview.draw($window);