Reset hud color if it was altered

This commit is contained in:
MysterD 2023-04-24 13:12:12 -07:00
parent 97d48d3278
commit d57646ab5f
3 changed files with 11 additions and 0 deletions

View file

@ -95,6 +95,7 @@ static void djui_reset_hud_params(void) {
djui_hud_set_resolution(RESOLUTION_DJUI); djui_hud_set_resolution(RESOLUTION_DJUI);
djui_hud_set_font(FONT_NORMAL); djui_hud_set_font(FONT_NORMAL);
djui_hud_set_rotation(0, 0, 0); djui_hud_set_rotation(0, 0, 0);
djui_hud_reset_color();
} }
void djui_render(void) { void djui_render(void) {

View file

@ -97,6 +97,7 @@ struct InterpHud {
}; };
static struct InterpHud sInterpHuds[MAX_INTERP_HUD] = { 0 }; static struct InterpHud sInterpHuds[MAX_INTERP_HUD] = { 0 };
static u16 sInterpHudCount = 0; static u16 sInterpHudCount = 0;
static u8 sColorAltered = FALSE;
void patch_djui_hud_before(void) { void patch_djui_hud_before(void) {
sInterpHudCount = 0; sInterpHudCount = 0;
@ -151,6 +152,14 @@ void djui_hud_set_font(enum DjuiFontType fontType) {
void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a) { void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a) {
gDPSetEnvColor(gDisplayListHead++, r, g, b, a); gDPSetEnvColor(gDisplayListHead++, r, g, b, a);
sColorAltered = TRUE;
}
void djui_hud_reset_color(void) {
if (sColorAltered) {
sColorAltered = FALSE;
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
}
} }
void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY) { void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY) {

View file

@ -39,6 +39,7 @@ extern u8 gDjuiHudLockMouse;
void djui_hud_set_resolution(enum HudUtilsResolution resolutionType); void djui_hud_set_resolution(enum HudUtilsResolution resolutionType);
void djui_hud_set_font(enum DjuiFontType fontType); void djui_hud_set_font(enum DjuiFontType fontType);
void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a); void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a);
void djui_hud_reset_color(void);
void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY); void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY);
u32 djui_hud_get_screen_width(void); u32 djui_hud_get_screen_width(void);