From fad901796c23e58e83329050ad229b48739395d6 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Fri, 31 Mar 2023 13:16:45 -0500 Subject: [PATCH] chore(gx): clean up screen stock initialization --- src/gx/Screen.cpp | 18 +++++++++--------- src/gx/Screen.hpp | 2 -- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/gx/Screen.cpp b/src/gx/Screen.cpp index aabf5cd..940df56 100644 --- a/src/gx/Screen.cpp +++ b/src/gx/Screen.cpp @@ -6,13 +6,14 @@ #include "gx/Gx.hpp" #include "gx/Transform.hpp" #include "util/Filesystem.hpp" +#include #include int32_t Screen::s_captureScreen = 0; float Screen::s_elapsedSec = 0.0f; int32_t Screen::s_presentDisable = 0; -HOBJECT Screen::s_stockObjects[]; -float Screen::s_stockObjectHeights[] = { 0.01953125f, 0.01953125f }; +static HOBJECT s_stockObjects[SCRNSTOCKOBJECTS]; +static float s_stockObjectHeights[SCRNSTOCKOBJECTS] = { 0.01953125f, 0.01953125f }; static STORM_EXPLICIT_LIST(CILayer, zorderlink) s_zOrderList; int32_t OnIdle(const EVENT_DATA_IDLE* data, void* a2) { @@ -152,9 +153,8 @@ void ILayerInitialize() { void IStockInitialize() { GxuFontInitialize(); - char fontFile[260]; - - OsBuildFontFilePath("FRIZQT__.TTF", fontFile, 260); + char fontFile[STORM_MAX_PATH]; + OsBuildFontFilePath("FRIZQT__.TTF", fontFile, sizeof(fontFile)); if (*fontFile) { ScrnSetStockFont(STOCK_SYSFONT, fontFile); @@ -209,11 +209,11 @@ void ScrnLayerCreate(const RECTF* rect, float zOrder, uint32_t flags, void* para } void ScrnSetStockFont(SCRNSTOCK stockID, const char* fontTexturePath) { - if (Screen::s_stockObjects[stockID]) { - HandleClose(Screen::s_stockObjects[stockID]); + if (s_stockObjects[stockID]) { + HandleClose(s_stockObjects[stockID]); } - float fontHeight = NDCToDDCHeight(Screen::s_stockObjectHeights[stockID]); + float fontHeight = NDCToDDCHeight(s_stockObjectHeights[stockID]); HTEXTFONT font = TextBlockGenerateFont(fontTexturePath, 0, fontHeight); - Screen::s_stockObjects[stockID] = font; + s_stockObjects[stockID] = font; } diff --git a/src/gx/Screen.hpp b/src/gx/Screen.hpp index 5281202..3b3d08f 100644 --- a/src/gx/Screen.hpp +++ b/src/gx/Screen.hpp @@ -34,8 +34,6 @@ namespace Screen { extern int32_t s_captureScreen; extern float s_elapsedSec; extern int32_t s_presentDisable; - extern HOBJECT s_stockObjects[SCRNSTOCKOBJECTS]; - extern float s_stockObjectHeights[SCRNSTOCKOBJECTS]; } void ILayerInitialize();