From 0e83927d4dba79642595b439ead5f83f726f276e Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 13 Aug 2020 13:41:03 +0200 Subject: [PATCH] Store the font size only once in GuiText --- include/gui/GuiText.h | 4 ++-- source/gui/GuiText.cpp | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/gui/GuiText.h b/include/gui/GuiText.h index 2e5abb8..0fbacc6 100644 --- a/include/gui/GuiText.h +++ b/include/gui/GuiText.h @@ -103,14 +103,14 @@ public: return maxWidth; } - //!Get fontsize void setSSAA(int32_t ssaa) { this->internalSSAA = ssaa; }; + //!Get fontsize int32_t getFontSize() { - return size; + return currentSize; }; //!Set max lines to draw diff --git a/source/gui/GuiText.cpp b/source/gui/GuiText.cpp index 9a2e439..cabf7cf 100644 --- a/source/gui/GuiText.cpp +++ b/source/gui/GuiText.cpp @@ -37,8 +37,7 @@ GX2ColorF32 GuiText::presetColor = (GX2ColorF32) { GuiText::GuiText() { text = NULL; - size = presetSize; - currentSize = size; + currentSize = presetSize; color = glm::vec4(presetColor.r, presetColor.g, presetColor.b, presetColor.a); alpha = presetColor.a; alignment = presetAlignment; @@ -58,8 +57,7 @@ GuiText::GuiText() { GuiText::GuiText(const char *t, int32_t s, const glm::vec4 &c) { text = NULL; - size = s; - currentSize = size; + currentSize = s; color = c; alpha = c[3]; alignment = ALIGN_CENTER | ALIGN_MIDDLE; @@ -86,8 +84,7 @@ GuiText::GuiText(const char *t, int32_t s, const glm::vec4 &c) { GuiText::GuiText(const wchar_t *t, int32_t s, const glm::vec4 &c) { text = NULL; - size = s; - currentSize = size; + currentSize = s; color = c; alpha = c[3]; alignment = ALIGN_CENTER | ALIGN_MIDDLE; @@ -119,8 +116,7 @@ GuiText::GuiText(const wchar_t *t, int32_t s, const glm::vec4 &c) { */ GuiText::GuiText(const char *t) { text = NULL; - size = presetSize; - currentSize = size; + currentSize = presetSize; color = glm::vec4(presetColor.r, presetColor.g, presetColor.b, presetColor.a); alpha = presetColor.a; alignment = presetAlignment; @@ -243,7 +239,7 @@ void GuiText::setPresetFont(FreeTypeGX *f) { } void GuiText::setFontSize(int32_t s) { - size = s; + currentSize = s; } void GuiText::setMaxWidth(int32_t width, int32_t w) {