summaryrefslogtreecommitdiff
path: root/ui/gameMainSelector.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-26 17:48:11 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-26 17:48:11 +0000
commit30f58cc3832bd1b5a5cadf4b0a4a9d47d024f9f7 (patch)
tree0e347320e8295f03efb3d12bd85e76f838bf51d3 /ui/gameMainSelector.cpp
parentAlways set pixel unpack alignment before generating font texture content (diff)
downloadilt-30f58cc3832bd1b5a5cadf4b0a4a9d47d024f9f7.tar.bz2
ilt-30f58cc3832bd1b5a5cadf4b0a4a9d47d024f9f7.tar.xz
ilt-30f58cc3832bd1b5a5cadf4b0a4a9d47d024f9f7.zip
Remove the static font cache
Each thing can own/share a font rendering itself
Diffstat (limited to 'ui/gameMainSelector.cpp')
-rw-r--r--ui/gameMainSelector.cpp12
1 files changed, 7 insertions, 5 deletions
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 <game/selectable.h>
#include <game/worldobject.h> // IWYU pragma: keep
#include <gfx/gl/camera.h>
-#include <math.h>
#include <optional>
-#include <span>
#include <stream_support.h>
#include <typeinfo>
-#include <vector>
-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);
}
}