Store the font size only once in GuiText

This commit is contained in:
Maschell 2020-08-13 13:41:03 +02:00
parent 427b511cb0
commit 0e83927d4d
2 changed files with 7 additions and 11 deletions

View File

@ -103,14 +103,14 @@ public:
return maxWidth; return maxWidth;
} }
//!Get fontsize
void setSSAA(int32_t ssaa) { void setSSAA(int32_t ssaa) {
this->internalSSAA = ssaa; this->internalSSAA = ssaa;
}; };
//!Get fontsize
int32_t getFontSize() { int32_t getFontSize() {
return size; return currentSize;
}; };
//!Set max lines to draw //!Set max lines to draw

View File

@ -37,8 +37,7 @@ GX2ColorF32 GuiText::presetColor = (GX2ColorF32) {
GuiText::GuiText() { GuiText::GuiText() {
text = NULL; text = NULL;
size = presetSize; currentSize = presetSize;
currentSize = size;
color = glm::vec4(presetColor.r, presetColor.g, presetColor.b, presetColor.a); color = glm::vec4(presetColor.r, presetColor.g, presetColor.b, presetColor.a);
alpha = presetColor.a; alpha = presetColor.a;
alignment = presetAlignment; alignment = presetAlignment;
@ -58,8 +57,7 @@ GuiText::GuiText() {
GuiText::GuiText(const char *t, int32_t s, const glm::vec4 &c) { GuiText::GuiText(const char *t, int32_t s, const glm::vec4 &c) {
text = NULL; text = NULL;
size = s; currentSize = s;
currentSize = size;
color = c; color = c;
alpha = c[3]; alpha = c[3];
alignment = ALIGN_CENTER | ALIGN_MIDDLE; 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) { GuiText::GuiText(const wchar_t *t, int32_t s, const glm::vec4 &c) {
text = NULL; text = NULL;
size = s; currentSize = s;
currentSize = size;
color = c; color = c;
alpha = c[3]; alpha = c[3];
alignment = ALIGN_CENTER | ALIGN_MIDDLE; 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) { GuiText::GuiText(const char *t) {
text = NULL; text = NULL;
size = presetSize; currentSize = presetSize;
currentSize = size;
color = glm::vec4(presetColor.r, presetColor.g, presetColor.b, presetColor.a); color = glm::vec4(presetColor.r, presetColor.g, presetColor.b, presetColor.a);
alpha = presetColor.a; alpha = presetColor.a;
alignment = presetAlignment; alignment = presetAlignment;
@ -243,7 +239,7 @@ void GuiText::setPresetFont(FreeTypeGX *f) {
} }
void GuiText::setFontSize(int32_t s) { void GuiText::setFontSize(int32_t s) {
size = s; currentSize = s;
} }
void GuiText::setMaxWidth(int32_t width, int32_t w) { void GuiText::setMaxWidth(int32_t width, int32_t w) {