summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-02-03 20:43:25 +0100
committerGitHub <noreply@github.com>2021-02-03 20:43:25 +0100
commit91c3bdfa15188054295e04b5152aa9169c38ce07 (patch)
treecccd13a63bfda33ac24af29ce7a6a15f880dd59d /src/render
parentand a space (diff)
parentAdd undef (diff)
downloadre3-91c3bdfa15188054295e04b5152aa9169c38ce07.tar
re3-91c3bdfa15188054295e04b5152aa9169c38ce07.tar.gz
re3-91c3bdfa15188054295e04b5152aa9169c38ce07.tar.bz2
re3-91c3bdfa15188054295e04b5152aa9169c38ce07.tar.lz
re3-91c3bdfa15188054295e04b5152aa9169c38ce07.tar.xz
re3-91c3bdfa15188054295e04b5152aa9169c38ce07.tar.zst
re3-91c3bdfa15188054295e04b5152aa9169c38ce07.zip
Diffstat (limited to '')
-rw-r--r--src/render/Font.cpp31
-rw-r--r--src/render/Font.h1
2 files changed, 28 insertions, 4 deletions
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index 7eed0933..7dba8094 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -348,11 +348,26 @@ CFont::Initialise(void)
SetDropShadowPosition(0);
CTxdStore::PopCurrentTxd();
+#if !defined(GAMEPAD_MENU) && defined(BUTTON_ICONS)
+ // loaded in CMenuManager with GAMEPAD_MENU defined
+ LoadButtons("MODELS/X360BTNS.TXD");
+#endif
+}
+
#ifdef BUTTON_ICONS
- if (int file = CFileMgr::OpenFile("MODELS/X360BTNS.TXD")) {
+void
+CFont::LoadButtons(const char* txdPath)
+{
+ if (int file = CFileMgr::OpenFile(txdPath)) {
CFileMgr::CloseFile(file);
- ButtonsSlot = CTxdStore::AddTxdSlot("buttons");
- CTxdStore::LoadTxd(ButtonsSlot, "MODELS/X360BTNS.TXD");
+ if (ButtonsSlot == -1)
+ ButtonsSlot = CTxdStore::AddTxdSlot("buttons");
+ else {
+ for (int i = 0; i < MAX_BUTTON_ICONS; i++)
+ ButtonSprite[i].Delete();
+ CTxdStore::RemoveTxd(ButtonsSlot);
+ }
+ CTxdStore::LoadTxd(ButtonsSlot, txdPath);
CTxdStore::AddRef(ButtonsSlot);
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(ButtonsSlot);
@@ -374,8 +389,16 @@ CFont::Initialise(void)
ButtonSprite[BUTTON_R3].SetTexture("r3");
CTxdStore::PopCurrentTxd();
}
-#endif // BUTTON_ICONS
+ else {
+ if (ButtonsSlot != -1) {
+ for (int i = 0; i < MAX_BUTTON_ICONS; i++)
+ ButtonSprite[i].Delete();
+ CTxdStore::RemoveTxdSlot(ButtonsSlot);
+ ButtonsSlot = -1;
+ }
+ }
}
+#endif // BUTTON_ICONS
#ifdef MORE_LANGUAGES
void
diff --git a/src/render/Font.h b/src/render/Font.h
index 621375d6..9316ed34 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -109,6 +109,7 @@ public:
static CSprite2d ButtonSprite[MAX_BUTTON_ICONS];
static int PS2Symbol;
+ static void LoadButtons(const char *txdPath);
static void DrawButton(float x, float y);
#endif // BUTTON_ICONS