From 30f58cc3832bd1b5a5cadf4b0a4a9d47d024f9f7 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 26 Jan 2024 17:48:11 +0000 Subject: Remove the static font cache Each thing can own/share a font rendering itself --- ui/gameMainSelector.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ui/gameMainSelector.cpp') diff --git a/ui/gameMainSelector.cpp b/ui/gameMainSelector.cpp index a577838..5bef48d 100644 --- a/ui/gameMainSelector.cpp +++ b/ui/gameMainSelector.cpp @@ -8,14 +8,16 @@ #include #include // IWYU pragma: keep #include -#include #include -#include #include #include -#include -GameMainSelector::GameMainSelector(const Camera * c, ScreenAbsCoord size) : UIComponent {{{}, size}}, camera {c} { } +const std::filesystem::path fontpath {"/usr/share/fonts/hack/Hack-Regular.ttf"}; + +GameMainSelector::GameMainSelector(const Camera * c, ScreenAbsCoord size) : + UIComponent {{{}, size}}, camera {c}, font {fontpath, 15} +{ +} constexpr ScreenAbsCoord TargetPos {5, 45}; @@ -26,7 +28,7 @@ GameMainSelector::render(const UIShader & shader, const Position & parentPos) co target->render(shader, parentPos + position + TargetPos); } if (!clicked.empty()) { - Text {clicked, {{50, 10}, {0, 15}}, {1, 1, 0}}.render(shader, parentPos); + Text {clicked, font, {{50, 10}, {0, 15}}, {1, 1, 0}}.render(shader, parentPos); } } -- cgit v1.2.3