mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Automatically resize join and confirm text
This commit is contained in:
parent
e86aa59a4d
commit
80aa63d090
4 changed files with 22 additions and 7 deletions
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue