From e75e355c3a59d53a1d64fd8fae3331b2234083e2 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 11 Dec 2024 22:17:43 +0100 Subject: text component pretty much finished --- src/crepe/facade/Font.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/crepe/facade/Font.cpp') 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 res){ const char* font_path = res->get_path(); - int font_size = Config::get_instance().font.font_size; this->font = std::unique_ptr( - 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(src)); } + Font::Font(std::unique_ptr res){ this->load(std::move(res)); } + const TTF_Font& Font::get_font() const{ return this->font; } -- cgit v1.2.3