Fix R Button Options text not changing font/language

This commit is contained in:
Agent X 2024-06-30 18:22:20 -04:00
parent f93aeb3c72
commit 2ac5bf4496
3 changed files with 16 additions and 11 deletions

View file

@ -18,7 +18,7 @@
static Gfx* sSavedDisplayListHead = NULL;
struct DjuiRoot* gDjuiRoot = NULL;
static struct DjuiText* sDjuiPauseOptions = NULL;
struct DjuiText* gDjuiPauseOptions = NULL;
static struct DjuiText* sDjuiLuaError = NULL;
static u32 sDjuiLuaErrorTimeout = 0;
bool gDjuiInMainMenu = true;
@ -34,9 +34,9 @@ void djui_shutdown(void) {
djui_panel_shutdown();
sSavedDisplayListHead = NULL;
if (sDjuiPauseOptions) djui_base_destroy(&sDjuiPauseOptions->base);
if (gDjuiPauseOptions) djui_base_destroy(&gDjuiPauseOptions->base);
if (sDjuiLuaError) djui_base_destroy(&sDjuiLuaError->base);
sDjuiPauseOptions = NULL;
gDjuiPauseOptions = NULL;
sDjuiLuaError = NULL;
sDjuiLuaErrorTimeout = 0;
@ -76,12 +76,12 @@ void patch_djui_interpolated(UNUSED f32 delta) {
void djui_init(void) {
gDjuiRoot = djui_root_create();
sDjuiPauseOptions = djui_text_create(&gDjuiRoot->base, DLANG(MISC, R_BUTTON));
djui_base_set_size_type(&sDjuiPauseOptions->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&sDjuiPauseOptions->base, 1.0f, 32);
djui_base_set_location(&sDjuiPauseOptions->base, 0, 16);
djui_text_set_alignment(sDjuiPauseOptions, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
djui_base_set_visible(&sDjuiPauseOptions->base, false);
gDjuiPauseOptions = djui_text_create(&gDjuiRoot->base, DLANG(MISC, R_BUTTON));
djui_base_set_size_type(&gDjuiPauseOptions->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&gDjuiPauseOptions->base, 1.0f, 32);
djui_base_set_location(&gDjuiPauseOptions->base, 0, 16);
djui_text_set_alignment(gDjuiPauseOptions, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
djui_base_set_visible(&gDjuiPauseOptions->base, false);
sDjuiLuaError = djui_text_create(&gDjuiRoot->base, "");
djui_base_set_size_type(&sDjuiLuaError->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@ -151,8 +151,8 @@ void djui_render(void) {
djui_panel_update();
djui_popup_update();
djui_base_set_visible(&sDjuiPauseOptions->base, (sCurrPlayMode == PLAY_MODE_PAUSED));
djui_base_set_visible(&sDjuiPauseOptions->base, (sCurrPlayMode == PLAY_MODE_PAUSED) && !gDjuiPanelPauseCreated);
djui_base_set_visible(&gDjuiPauseOptions->base, (sCurrPlayMode == PLAY_MODE_PAUSED));
djui_base_set_visible(&gDjuiPauseOptions->base, (sCurrPlayMode == PLAY_MODE_PAUSED) && !gDjuiPanelPauseCreated);
if (gDjuiRoot != NULL) {
djui_base_render(&gDjuiRoot->base);
}

View file

@ -37,6 +37,7 @@
#include "djui_paginated.h"
extern struct DjuiRoot* gDjuiRoot;
extern struct DjuiText* gDjuiPauseOptions;
extern bool gDjuiInMainMenu;
extern bool gDjuiInPlayerMenu;
extern bool gDjuiDisabled;

View file

@ -6,6 +6,7 @@
#include "djui_panel_options.h"
#include "djui_panel_misc.h"
#include "djui_panel_pause.h"
#include "djui_hud_utils.h"
#include "pc/utils/misc.h"
#include "pc/configfile.h"
#include "game/level_update.h"
@ -42,6 +43,9 @@ static void djui_panel_menu_options_djui_setting_change(UNUSED struct DjuiBase*
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
djui_panel_main_menu_create(NULL);
djui_text_set_font(gDjuiPauseOptions, gDjuiFonts[configDjuiThemeFont == 0 ? FONT_NORMAL : FONT_ALIASED]);
djui_text_set_text(gDjuiPauseOptions, DLANG(MISC, R_BUTTON));
}
}