From c7c59975caa54b9f376af5c8dd4f8bda39ac659f Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Fri, 24 Mar 2017 10:46:33 +0800 Subject: [PATCH] Add Font::ready() Now we can check if a Font Object is Ready. ( Font Library Loaded ) --- MiniEngine.cpp | 5 +++++ MiniEngine.h | 1 + 2 files changed, 6 insertions(+) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 7069156..886307a 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -566,6 +566,11 @@ namespace MiniEngine font.reset(temp, TTF_CloseFont); return 0; } + + bool Font::isReady() + { + return (font.get() != nullptr); + } Texture Font::renderText(Renderer rnd, std::string Text, RGBA fg) { diff --git a/MiniEngine.h b/MiniEngine.h index cac60d0..c809e86 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -219,6 +219,7 @@ namespace MiniEngine Font() = default; Font(std::string FontFileName, int size) throw(ErrorViewer); int use(std::string FontFileName, int size); + bool isReady(); Texture renderText(Renderer rnd, std::string Text, RGBA fg); Texture renderTextWrapped(Renderer rnd, std::string Text, RGBA fg, int WrapLength); Texture renderTextShaded(Renderer rnd, std::string Text, RGBA fg, RGBA bg);