From e788b16aff5c93043b9f20d588bf2960d539dcdd Mon Sep 17 00:00:00 2001 From: iZePlayz <69536095+iZePlayzYT@users.noreply.github.com> Date: Fri, 21 Nov 2025 00:43:39 +0100 Subject: [PATCH] some fixes and slider color adjustments --- src/pc/djui/djui_chat_box.c | 3 ++- src/pc/djui/djui_chat_message.c | 3 ++- src/pc/djui/djui_panel_chat.c | 36 +++++++++++++++++++-------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 98282ab25..f3287fedd 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -621,7 +621,8 @@ void djui_chat_box_toggle(void) { gDjuiChatBoxFocus = !gDjuiChatBoxFocus; djui_chat_box_set_focus_style(); gDjuiChatBox->scrolling = false; - gDjuiChatBox->chatFlow->base.y.value = gDjuiChatBox->chatContainer->base.elem.height - gDjuiChatBox->chatFlow->base.height.value; + f32 containerHeight = gDjuiChatBox->base.height.value - 32.0f - 18.0f; + gDjuiChatBox->chatFlow->base.y.value = containerHeight - gDjuiChatBox->chatFlow->base.height.value; } void djui_chat_box_open_with_text(const char* text) { diff --git a/src/pc/djui/djui_chat_message.c b/src/pc/djui/djui_chat_message.c index f6a7ee665..e978aa3cf 100644 --- a/src/pc/djui/djui_chat_message.c +++ b/src/pc/djui/djui_chat_message.c @@ -136,7 +136,8 @@ void djui_chat_messages_apply_style(void) { } if (!gDjuiChatBox->scrolling) { - gDjuiChatBox->chatFlow->base.y.value = gDjuiChatBox->chatContainer->base.elem.height - gDjuiChatBox->chatFlow->base.height.value; + f32 containerHeight = gDjuiChatBox->base.height.value - 32.0f - 18.0f; + gDjuiChatBox->chatFlow->base.y.value = containerHeight - gDjuiChatBox->chatFlow->base.height.value; } } diff --git a/src/pc/djui/djui_panel_chat.c b/src/pc/djui/djui_panel_chat.c index e2aa5ef90..dd6b075e3 100644 --- a/src/pc/djui/djui_panel_chat.c +++ b/src/pc/djui/djui_panel_chat.c @@ -8,6 +8,21 @@ static struct DjuiText* sChatTextScaleLabel = NULL; static struct DjuiText* sChatOpacityLabel = NULL; static struct DjuiText* sChatLifetimeLabel = NULL; +static void djui_panel_chat_apply_chatbox_style(void) { + djui_chat_messages_apply_style(); + if (gDjuiChatBox != NULL) { + bool hasMessages = (gDjuiChatBox->chatFlow->base.height.value > 2.0f); + u8 alpha = 0; + if (hasMessages) { + int baseAlpha = (int)(configChatOpacity * 2.55f); + if (baseAlpha > 255) { baseAlpha = 255; } + if (baseAlpha < 0) { baseAlpha = 0; } + alpha = gDjuiChatBoxFocus ? (u8)baseAlpha : 0; + } + djui_base_set_color(&gDjuiChatBox->chatFlow->base, 0, 0, 0, alpha); + } +} + static void djui_panel_chat_update_value_labels(void) { if (sChatTextScaleLabel != NULL) { char buf[16]; @@ -17,7 +32,7 @@ static void djui_panel_chat_update_value_labels(void) { if (configChatTextScale < 100) { djui_base_set_color(base, 64, 64, 255, 255); } else if (configChatTextScale == 100) { - djui_base_set_color(base, 48, 224, 48, 255); + djui_base_set_color(base, 16, 255, 16, 255); } else { djui_base_set_color(base, 255, 64, 64, 255); } @@ -31,7 +46,7 @@ static void djui_panel_chat_update_value_labels(void) { if (configChatOpacity < 70) { djui_base_set_color(base, 64, 64, 255, 255); } else if (configChatOpacity == 70) { - djui_base_set_color(base, 48, 224, 48, 255); + djui_base_set_color(base, 16, 255, 16, 255); } else { djui_base_set_color(base, 255, 64, 64, 255); } @@ -45,7 +60,7 @@ static void djui_panel_chat_update_value_labels(void) { if (configChatMessageLifetime < 10) { djui_base_set_color(base, 64, 64, 255, 255); } else if (configChatMessageLifetime == 10) { - djui_base_set_color(base, 64, 255, 64, 255); + djui_base_set_color(base, 16, 255, 16, 255); } else { djui_base_set_color(base, 255, 64, 64, 255); } @@ -112,6 +127,7 @@ void djui_panel_chat_create(struct DjuiBase* caller) { configChatWidth = widths[idx]; if (gDjuiChatBox != NULL) { djui_base_set_size(&gDjuiChatBox->base, configChatWidth, gDjuiChatBox->base.height.value); + djui_panel_chat_apply_chatbox_style(); } } void on_chat_height_change(UNUSED struct DjuiBase* b) { @@ -120,6 +136,7 @@ void djui_panel_chat_create(struct DjuiBase* caller) { configChatHeight = heights[idx]; if (gDjuiChatBox != NULL) { djui_base_set_size(&gDjuiChatBox->base, gDjuiChatBox->base.width.value, configChatHeight); + djui_panel_chat_apply_chatbox_style(); } } @@ -127,18 +144,7 @@ void djui_panel_chat_create(struct DjuiBase* caller) { djui_selectionbox_create(body, DLANG(CHAT_OPTIONS, CHAT_HEIGHT), chatSizeChoices, 11, &sChatHeightIndex, on_chat_height_change); void on_chat_style_change(UNUSED struct DjuiBase* b) { - djui_chat_messages_apply_style(); - if (gDjuiChatBox != NULL) { - bool hasMessages = (gDjuiChatBox->chatFlow->base.height.value > 2.0f); - u8 alpha = 0; - if (hasMessages) { - int baseAlpha = (int)(configChatOpacity * 2.55f); - if (baseAlpha > 255) { baseAlpha = 255; } - if (baseAlpha < 0) { baseAlpha = 0; } - alpha = gDjuiChatBoxFocus ? (u8)baseAlpha : 0; - } - djui_base_set_color(&gDjuiChatBox->chatFlow->base, 0, 0, 0, alpha); - } + djui_panel_chat_apply_chatbox_style(); djui_panel_chat_update_value_labels(); } void on_chat_lifetime_change(UNUSED struct DjuiBase* b) {