#include #include #include #include "font.hpp" namespace hibis::rsdl { Font::Font(std::string path, uint size) { this->size = size; this->path = path; loadFont(); } Font::~Font() { TTF_CloseFont(loadedFont); } void Font::loadFont(bool reload) { // If already loaded, close font if (loadedFont != NULL) { TTF_CloseFont(loadedFont); loadedFont = NULL; } loadedFont = TTF_OpenFont(path.c_str(), size); // Do the message if (!didReload) { std::cout << fmt::format((reload ? "Reloaded font from" : "Loaded font at") + (std::string)" {}", path) << std::endl; didReload = reload; } } }