diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 22:17:43 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 22:17:43 +0100 |
commit | e75e355c3a59d53a1d64fd8fae3331b2234083e2 (patch) | |
tree | 24176a074d529271e7279794f7fa2dcf5aed2525 /src/crepe/facade/Font.cpp | |
parent | bb2a6f1a0ab19f6cbc78b2747a26920f24bf13ca (diff) |
text component pretty much finished
Diffstat (limited to 'src/crepe/facade/Font.cpp')
-rw-r--r-- | src/crepe/facade/Font.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/crepe/facade/Font.cpp b/src/crepe/facade/Font.cpp index 2ad176a..b600b01 100644 --- a/src/crepe/facade/Font.cpp +++ b/src/crepe/facade/Font.cpp @@ -1,24 +1,28 @@ -#include "font.h" #include "../api/Config.h" + +#include "font.h" + using namespace std; using namespace crepe; void Font::load(unique_ptr<Asset> res){ const char* font_path = res->get_path(); - int font_size = Config::get_instance().font.font_size; this->font = std::unique_ptr<TTF_Font, decltype(&TTF_CloseFont)>( - TTF_OpenFont(font_path, font_size), &TTF_CloseFont); + TTF_OpenFont(font_path, this->default_font_size), &TTF_CloseFont); if (!font) { throw std::runtime_error("Failed to load font: " + std::string(TTF_GetError())); } } + Font::Font(const char* src){ this->load(make_unique<Asset>(src)); } + Font::Font(std::unique_ptr<Asset> res){ this->load(std::move(res)); } + const TTF_Font& Font::get_font() const{ return this->font; } |