From c550638796287a653a08dafb543120cab927dccc Mon Sep 17 00:00:00 2001 From: Tristan Cormier Date: Thu, 20 Nov 2025 19:13:04 -0500 Subject: [PATCH] feat(console): add SetInputString --- src/console/Screen.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/console/Screen.cpp b/src/console/Screen.cpp index 4eed1e9..1d382c8 100644 --- a/src/console/Screen.cpp +++ b/src/console/Screen.cpp @@ -15,13 +15,16 @@ #include static CGxStringBatch* s_batch; +static uint32_t s_baseTextFlags; static float s_caretpixwidth; static float s_caretpixheight; +static float s_charSpacing; static float s_consoleLines = 10.0f; static float s_fontHeight = 0.02f; static float s_consoleHeight = s_consoleLines * s_fontHeight; static char s_fontName[STORM_MAX_PATH]; static HIGHLIGHTSTATE s_highlightState; +static CGxString* s_inputString; static HLAYER s_layerBackground; static HLAYER s_layerText; static RECTF s_rect = { 0.0f, 1.0f, 1.0f, 1.0f }; @@ -40,6 +43,37 @@ static CImVector s_colorArray[] = { { 0x00, 0x00, 0x00, 0xC0 }, // BACKGROUND_COLOR }; +static void SetInputString(char* text) { + if (s_inputString) { + GxuFontDestroyString(s_inputString); + } + + s_inputString = nullptr; + + if (text && *text) { + C3Vector pos = { 0.0f, 0.0f, 1.0f }; + + auto font = TextBlockGetFontPtr(s_textFont); + + GxuFontCreateString( + font, + text, + s_fontHeight, + pos, + 1.0f, + s_fontHeight, + 0.0f, + s_inputString, + EGxFontVJusts::GxVJ_Middle, + EGxFontHJusts::GxHJ_Left, + s_baseTextFlags, + s_colorArray[INPUT_COLOR], + s_charSpacing, + 1.0f + ); + } +} + CONSOLELINE::~CONSOLELINE() { if (this->buffer) { STORM_FREE(this->buffer);