From cf4d5a598d0c2e9505ef5fb89f6bd3322d6d7ea1 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sun, 14 Dec 2025 15:55:55 -0600 Subject: [PATCH] feat(gx): add CGxString::HandleScreenSizeChange --- src/gx/font/CGxString.cpp | 10 ++++++++++ src/gx/font/CGxString.hpp | 1 + 2 files changed, 11 insertions(+) diff --git a/src/gx/font/CGxString.cpp b/src/gx/font/CGxString.cpp index 66d8f79..42d92e3 100644 --- a/src/gx/font/CGxString.cpp +++ b/src/gx/font/CGxString.cpp @@ -338,6 +338,16 @@ void CGxString::CreateGeometry() { } } +void CGxString::HandleScreenSizeChange() { + if (this->m_flags & 0x4) { + this->m_requestedFontHeight = GxuFontGetOneToOneHeight(this->m_currentFace); + } + + this->m_currentFontHeight = std::max(2.0f / g_heightPixels, this->m_requestedFontHeight); + + this->ClearInstanceData(); +} + int32_t CGxString::Initialize(float fontHeight, const C3Vector& position, float blockWidth, float blockHeight, CGxFont* face, const char* text, EGxFontVJusts vertJust, EGxFontHJusts horzJust, float spacing, uint32_t flags, const CImVector& color, float scale) { uint32_t textLen = SStrLen(text) + 1; if (textLen > this->m_textLen) { diff --git a/src/gx/font/CGxString.hpp b/src/gx/font/CGxString.hpp index ddd4707..4dba6f0 100644 --- a/src/gx/font/CGxString.hpp +++ b/src/gx/font/CGxString.hpp @@ -70,6 +70,7 @@ class CGxString : public TSLinkedNode { bool CheckGeometry(void); void ClearInstanceData(void); void CreateGeometry(void); + void HandleScreenSizeChange(); int32_t Initialize(float, const C3Vector&, float, float, CGxFont*, const char*, EGxFontVJusts, EGxFontHJusts, float, uint32_t, const CImVector&, float); void InitializeTextLine(const char*, uint32_t, CImVector&, const C3Vector&, uint32_t*, EMBEDDEDPARSEINFO&); void InitializeViewTranslation(void);