diff --git a/src/pc/djui/djui_base.c b/src/pc/djui/djui_base.c index 4c80de58..ed8be254 100644 --- a/src/pc/djui/djui_base.c +++ b/src/pc/djui/djui_base.c @@ -174,6 +174,13 @@ void djui_base_compute(struct DjuiBase* base) { djui_base_clip(base); } +void djui_base_compute_tree(struct DjuiBase* base) { + if (base->parent != NULL) { + djui_base_compute_tree(base->parent); + } + djui_base_compute(base); +} + static void djui_base_add_child(struct DjuiBase* parent, struct DjuiBase* base) { if (parent == NULL) { return; } diff --git a/src/pc/djui/djui_base.h b/src/pc/djui/djui_base.h index f38bea04..0c40ea0b 100644 --- a/src/pc/djui/djui_base.h +++ b/src/pc/djui/djui_base.h @@ -65,6 +65,7 @@ void djui_base_set_padding_type(struct DjuiBase* base, enum DjuiScreenValueType void djui_base_set_alignment(struct DjuiBase* base, enum DjuiHAlign hAlign, enum DjuiVAlign vAlign); void djui_base_compute(struct DjuiBase* base); +void djui_base_compute_tree(struct DjuiBase* base); bool djui_base_render(struct DjuiBase* base); void djui_base_destroy(struct DjuiBase* base); diff --git a/src/pc/djui/djui_panel_confirm.c b/src/pc/djui/djui_panel_confirm.c index 1a58c023..04d2a202 100644 --- a/src/pc/djui/djui_panel_confirm.c +++ b/src/pc/djui/djui_panel_confirm.c @@ -7,7 +7,13 @@ void djui_panel_confirm_create(struct DjuiBase* caller, char* title, char* messa { struct DjuiText* text = djui_text_create(body, message); djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&text->base, 1.0f, 64); + djui_base_compute_tree(&text->base); + u16 lines = djui_text_count_lines(text, 12); + f32 textHeight = 32 * 0.8125f * lines + 8; + djui_base_set_size(&text->base, 1.0f, textHeight); + djui_base_set_color(&text->base, 200, 200, 200, 255); djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP); diff --git a/src/pc/djui/djui_panel_join.c b/src/pc/djui/djui_panel_join.c index dca9390b..92524004 100644 --- a/src/pc/djui/djui_panel_join.c +++ b/src/pc/djui/djui_panel_join.c @@ -145,13 +145,6 @@ void djui_panel_join_do_join(struct DjuiBase* caller) { } void djui_panel_join_create(struct DjuiBase* caller) { - u16 directLines = 1; - f32 directTextHeight = 32 * 0.8125f * directLines + 8; - -#ifdef DISCORD_SDK - u16 discordLines = 8; - f32 discordTextHeight = 32 * 0.8125f * discordLines + 8; -#endif struct DjuiBase* defaultBase = NULL; struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(JOIN, JOIN_TITLE)); @@ -160,6 +153,10 @@ void djui_panel_join_create(struct DjuiBase* caller) { #ifdef DISCORD_SDK struct DjuiText* text1 = djui_text_create(body, DLANG(JOIN, JOIN_DISCORD)); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&text1->base, 1.0f, 100); + djui_base_compute_tree(&text1->base); + u16 discordLines = djui_text_count_lines(text1, 12); + f32 discordTextHeight = 32 * 0.8125f * discordLines + 8; djui_base_set_size(&text1->base, 1.0f, discordTextHeight); djui_base_set_color(&text1->base, 200, 200, 200, 255); #endif @@ -170,6 +167,10 @@ void djui_panel_join_create(struct DjuiBase* caller) { struct DjuiText* text2 = djui_text_create(body, DLANG(JOIN, JOIN_SOCKET)); djui_base_set_size_type(&text2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&text2->base, 1.0f, 100); + djui_base_compute_tree(&text2->base); + u16 directLines = djui_text_count_lines(text2, 12); + f32 directTextHeight = 32 * 0.8125f * directLines + 8; djui_base_set_size(&text2->base, 1.0f, directTextHeight); djui_base_set_color(&text2->base, 200, 200, 200, 255);