aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/Font.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 18:21:03 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 18:21:03 +0100
commit007fe1ecb5e9f76539cdffd6a96afe22c8b2d214 (patch)
treee3a3fc0984b77e0632a7e869f66553edceebedfc /src/crepe/facade/Font.h
parentc585731ab4557e2a03be9630a54295a3700103fc (diff)
save
Diffstat (limited to 'src/crepe/facade/Font.h')
-rw-r--r--src/crepe/facade/Font.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/crepe/facade/Font.h b/src/crepe/facade/Font.h
new file mode 100644
index 0000000..e34ac63
--- /dev/null
+++ b/src/crepe/facade/Font.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <memory>
+#include <SDL2/SDL_ttf.h>
+
+#include "../api/Asset.h"
+#include "../api/Config.h"
+
+namespace crepe {
+
+/**
+ * \brief Font resource facade
+ *
+ * This class is a wrapper around an SDL_ttf font instance, encapsulating font loading and usage.
+ */
+class Font : public Resource{
+public:
+ /**.
+ * \param src Asset with texture data to load.
+ * \param mediator use the SDLContext reference to load the image
+ */
+ Font(const Asset & src, Mediator & mediator);
+
+
+ ~Font() = default
+ const TTF_Font& get_font() const;
+private:
+ //! The SDL_ttf font object with custom deleter.
+ std::unique_ptr<TTF_Font, decltype(&TTF_CloseFont)> font;
+ int default_font_size = Config::get_instance().font.font_size;
+};
+
+} // namespace crepe