diff options
Diffstat (limited to 'src/crepe/facade/Font.cpp')
-rw-r--r-- | src/crepe/facade/Font.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/crepe/facade/Font.cpp b/src/crepe/facade/Font.cpp index a9f1633..8c16563 100644 --- a/src/crepe/facade/Font.cpp +++ b/src/crepe/facade/Font.cpp @@ -1,3 +1,4 @@ +#include "../api/Asset.h" #include "../api/Config.h" #include "util/Log.h" #include <iostream> @@ -11,17 +12,12 @@ Font::Font(const Asset & src, Mediator & mediator) : Resource(src, mediator) { dbg_trace(); Config & config = Config::get_instance(); - const std::string & FONT_PATH = src.get_path(); - cout << FONT_PATH.c_str() << endl; - TTF_Font * font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size); - if (font == NULL) + const std::string FONT_PATH = src.get_path(); + TTF_Font * loaded_font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size); + if (loaded_font == NULL) { throw runtime_error(format("Font: {} (path: {})", TTF_GetError(), FONT_PATH)); - this->font = {font, [](TTF_Font * font) { TTF_CloseFont(font); }}; -} - -Font::~Font(){ - dbg_trace(); - this->font.reset(); + } + this->font = {loaded_font, [](TTF_Font * font) { TTF_CloseFont(font); }}; } TTF_Font * Font::get_font() const { return this->font.get(); } |