mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 01:52:43 +00:00
Merge cb7530b932 into 7604ef9297
This commit is contained in:
commit
cf2611d8e5
27 changed files with 213 additions and 52 deletions
|
|
@ -64,6 +64,7 @@ BACK = "Zpět"
|
|||
CANCEL = "Zrušit"
|
||||
NO = "Ne"
|
||||
YES = "Ano"
|
||||
SEARCH = "Hledat..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "KAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Terug"
|
|||
CANCEL = "Stop"
|
||||
NO = "Nee"
|
||||
YES = "Ja"
|
||||
SEARCH = "Zoek..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "CAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Back"
|
|||
CANCEL = "Cancel"
|
||||
NO = "No"
|
||||
YES = "Yes"
|
||||
SEARCH = "Search..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "CAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Retour"
|
|||
CANCEL = "Annuler"
|
||||
NO = "Non"
|
||||
YES = "Oui"
|
||||
SEARCH = "Rechercher..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "CAMÉRA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Zurück"
|
|||
CANCEL = "Abbrechen"
|
||||
NO = "Nein"
|
||||
YES = "Ja"
|
||||
SEARCH = "Suche..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "KAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Indietro"
|
|||
CANCEL = "Annulla"
|
||||
NO = "No"
|
||||
YES = "Si"
|
||||
SEARCH = "Cerca..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "TELECAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "戻る"
|
|||
CANCEL = "キャンセル"
|
||||
NO = "いいえ"
|
||||
YES = "はい"
|
||||
SEARCH = "検索…"
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "CAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Wróć"
|
|||
CANCEL = "Anuluj"
|
||||
NO = "Nie"
|
||||
YES = "Tak"
|
||||
SEARCH = "Szukaj..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "KAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Voltar"
|
|||
CANCEL = "Cancelar"
|
||||
NO = "Não"
|
||||
YES = "Sim"
|
||||
SEARCH = "Pesquisar..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "CÂMERA"
|
||||
|
|
@ -413,7 +414,7 @@ MUTE_FOCUS_LOSS = "Silenciar quando a janela estiver desfocada"
|
|||
|
||||
[LANGUAGE]
|
||||
LANGUAGE = "IDIOMA"
|
||||
Czech = "Tcheco (Čeština)"
|
||||
Czech = "Tcheco (Čeština)"
|
||||
Dutch = "Holandês (Nederlands)"
|
||||
French = "Francês (Français)"
|
||||
German = "Alemão (Deutsch)"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Назад"
|
|||
CANCEL = "Отмена"
|
||||
NO = "Нет"
|
||||
YES = "Да"
|
||||
SEARCH = "Поиск..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "CAMERA"
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ BACK = "Volver"
|
|||
CANCEL = "Cancelar"
|
||||
NO = "No"
|
||||
YES = "Sí"
|
||||
SEARCH = "Buscar..."
|
||||
|
||||
[CAMERA]
|
||||
CAMERA = "CÁMARA"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "djui_progress_bar.h"
|
||||
#include "djui_checkbox.h"
|
||||
#include "djui_flow_layout.h"
|
||||
#include "djui_searchbox.h"
|
||||
#include "djui_selectionbox.h"
|
||||
#include "djui_bind.h"
|
||||
#include "djui_popup.h"
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ static bool djui_chat_box_input_on_key_down(UNUSED struct DjuiBase* base, int sc
|
|||
sent_history_init(&sentHistory);
|
||||
|
||||
if (gDjuiChatBox == NULL) { return false; }
|
||||
|
||||
|
||||
f32 pageAmount = gDjuiChatBox->chatContainer->base.elem.height * 3.0f / 4.0f;
|
||||
|
||||
char previousText[MAX_CHAT_MSG_LENGTH];
|
||||
|
|
@ -547,7 +547,7 @@ struct DjuiChatBox* djui_chat_box_create(void) {
|
|||
struct DjuiBase* cfBase = &chatFlow->base;
|
||||
djui_base_set_location(cfBase, 0, 0);
|
||||
djui_base_set_size_type(cfBase, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(cfBase, 1.0f, 2);
|
||||
djui_base_set_size(cfBase, 1.0f, 0);
|
||||
djui_base_set_color(cfBase, 0, 0, 0, 128);
|
||||
djui_base_set_padding(cfBase, 2, 2, 2, 2);
|
||||
djui_flow_layout_set_margin(chatFlow, 2);
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ void djui_chat_message_create(const char* message) {
|
|||
chatText->base.comp.width = maxTextWidth;
|
||||
f32 messageHeight = djui_text_count_lines(chatText, 10) * (chatText->font->lineHeight * chatText->font->defaultFontScale) + 8;
|
||||
djui_base_set_size(base, 1.0f, messageHeight);
|
||||
if (gDjuiChatBox->chatFlow->base.height.value == 0) {
|
||||
gDjuiChatBox->chatFlow->base.height.value = 2;
|
||||
}
|
||||
gDjuiChatBox->chatFlow->base.height.value += messageHeight + gDjuiChatBox->chatFlow->margin.value;
|
||||
if (!gDjuiChatBox->scrolling) {
|
||||
gDjuiChatBox->chatFlow->base.y.value = gDjuiChatBox->chatContainer->base.elem.height - gDjuiChatBox->chatFlow->base.height.value;
|
||||
|
|
|
|||
|
|
@ -20,15 +20,27 @@ static u8 sCursorBlink = 0;
|
|||
|
||||
static void djui_inputbox_update_style(struct DjuiBase* base) {
|
||||
struct DjuiInputbox* inputbox = (struct DjuiInputbox*)base;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (!inputbox->base.enabled) {
|
||||
djui_base_set_border_color(base, 90, 90, 90, 255);
|
||||
djui_base_set_color(&inputbox->base, 140, 140, 140, 255);
|
||||
struct DjuiColor bc = djui_theme_shade_color(theme->interactables.defaultBorderColor, 0.6f);
|
||||
struct DjuiColor rc = djui_theme_shade_color(theme->interactables.defaultRectColor, 0.6f);
|
||||
djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
|
||||
djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
|
||||
} else if (gDjuiCursorDownOn == base) {
|
||||
struct DjuiColor bc = theme->interactables.cursorDownBorderColor;
|
||||
struct DjuiColor rc = theme->interactables.cursorDownRectColor;
|
||||
djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
|
||||
djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
|
||||
} else if (gDjuiHovered == base) {
|
||||
djui_base_set_border_color(base, 0, 120, 215, 255);
|
||||
djui_base_set_color(&inputbox->base, 255, 255, 255, 255);
|
||||
struct DjuiColor bc = theme->interactables.hoveredBorderColor;
|
||||
struct DjuiColor rc = theme->interactables.hoveredRectColor;
|
||||
djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
|
||||
djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
|
||||
} else {
|
||||
djui_base_set_border_color(base, 150, 150, 150, 255);
|
||||
djui_base_set_color(&inputbox->base, 240, 240, 240, 255);
|
||||
struct DjuiColor bc = theme->interactables.defaultBorderColor;
|
||||
struct DjuiColor rc = theme->interactables.defaultRectColor;
|
||||
djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
|
||||
djui_base_set_color(&inputbox->base, rc.r, rc.g, rc.b, rc.a);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -397,7 +409,7 @@ void djui_inputbox_on_text_input(struct DjuiBase *base, char* text) {
|
|||
inputbox->selection[1] = inputbox->selection[0];
|
||||
sCursorBlink = 0;
|
||||
djui_inputbox_on_change(inputbox);
|
||||
|
||||
|
||||
inputbox->imePos = 0;
|
||||
if (inputbox->imeBuffer != NULL) {
|
||||
free(inputbox->imeBuffer);
|
||||
|
|
@ -408,9 +420,9 @@ void djui_inputbox_on_text_input(struct DjuiBase *base, char* text) {
|
|||
void djui_inputbox_on_text_editing(struct DjuiBase *base, char* text, int cursorPos) {
|
||||
struct DjuiInputbox *inputbox = (struct DjuiInputbox *) base;
|
||||
inputbox->imePos = (u16)cursorPos;
|
||||
|
||||
|
||||
if (inputbox->imeBuffer != NULL) free(inputbox->imeBuffer);
|
||||
|
||||
|
||||
if (*text == '\0') {
|
||||
inputbox->imeBuffer = NULL;
|
||||
}
|
||||
|
|
@ -420,7 +432,7 @@ void djui_inputbox_on_text_editing(struct DjuiBase *base, char* text, int cursor
|
|||
strcpy(copy,text);
|
||||
inputbox->imeBuffer = copy;
|
||||
}
|
||||
|
||||
|
||||
djui_inputbox_on_change(inputbox);
|
||||
}
|
||||
|
||||
|
|
@ -469,9 +481,9 @@ static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) {
|
|||
}
|
||||
|
||||
sCursorBlink = (sCursorBlink + 1) % DJUI_INPUTBOX_MAX_BLINK;
|
||||
|
||||
|
||||
f32 renderX = x;
|
||||
|
||||
|
||||
u16 imePos = inputbox->imePos;
|
||||
if (imePos != 0) {
|
||||
char* ime = inputbox->imeBuffer;
|
||||
|
|
@ -480,13 +492,13 @@ static void djui_inputbox_render_selection(struct DjuiInputbox* inputbox) {
|
|||
ime = djui_unicode_next_char(ime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// render only cursor when there is no selection width
|
||||
if (selection[0] == selection[1]) {
|
||||
if (sCursorBlink < DJUI_INPUTBOX_MID_BLINK && djui_interactable_is_input_focus(&inputbox->base)) {
|
||||
create_dl_translation_matrix(DJUI_MTX_PUSH, renderX - DJUI_INPUTBOX_CURSOR_WIDTH / 2.0f, -0.1f, 0);
|
||||
create_dl_scale_matrix(DJUI_MTX_NOPUSH, DJUI_INPUTBOX_CURSOR_WIDTH, 0.8f, 1.0f);
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
|
||||
gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a);
|
||||
gSPDisplayList(gDisplayListHead++, dl_djui_simple_rect);
|
||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
|
@ -559,7 +571,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
|
|||
|
||||
// translate position
|
||||
f32 translatedX = comp->x + inputbox->viewX;
|
||||
f32 translatedY = comp->y + DJUI_INPUTBOX_YOFF;
|
||||
f32 translatedY = comp->y + inputbox->yOffset;
|
||||
djui_gfx_position_translate(&translatedX, &translatedY);
|
||||
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, 0);
|
||||
|
||||
|
|
@ -583,7 +595,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
|
|||
u16 selection[2] = { 0 };
|
||||
selection[0] = fmin(inputbox->selection[0], inputbox->selection[1]);
|
||||
selection[1] = fmax(inputbox->selection[0], inputbox->selection[1]);
|
||||
|
||||
|
||||
// render text
|
||||
char* c = inputbox->buffer;
|
||||
f32 drawX = inputbox->viewX;
|
||||
|
|
@ -592,7 +604,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
|
|||
|
||||
font->render_begin();
|
||||
for (u16 i = 0; i < inputbox->bufferSize; i++) {
|
||||
|
||||
|
||||
//render composition text
|
||||
if (selection[0] == i && inputbox->imeBuffer != NULL) {
|
||||
char *ime = inputbox->imeBuffer;
|
||||
|
|
@ -601,7 +613,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
|
|||
ime = djui_unicode_next_char(ime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (*c == '\0') { break; }
|
||||
|
||||
// deal with seleciton color
|
||||
|
|
@ -635,14 +647,15 @@ static void djui_inputbox_destroy(struct DjuiBase* base) {
|
|||
struct DjuiInputbox* djui_inputbox_create(struct DjuiBase* parent, u16 bufferSize) {
|
||||
struct DjuiInputbox* inputbox = calloc(1, sizeof(struct DjuiInputbox));
|
||||
struct DjuiBase* base = &inputbox->base;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
inputbox->bufferSize = bufferSize;
|
||||
inputbox->buffer = calloc(bufferSize, sizeof(char));
|
||||
inputbox->yOffset = DJUI_INPUTBOX_YOFF;
|
||||
|
||||
djui_base_init(parent, base, djui_inputbox_render, djui_inputbox_destroy);
|
||||
djui_base_set_size(base, 200, 32);
|
||||
djui_base_set_border_width(base, 2);
|
||||
djui_base_set_gradient(base, false);
|
||||
djui_inputbox_set_text_color(inputbox, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
djui_interactable_create(base, djui_inputbox_update_style);
|
||||
djui_interactable_hook_cursor_down(base, djui_inputbox_on_cursor_down_begin, djui_inputbox_on_cursor_down, NULL);
|
||||
djui_interactable_hook_key(base, djui_inputbox_on_key_down, djui_inputbox_on_key_up);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ struct DjuiInputbox {
|
|||
u16 bufferSize;
|
||||
u16 selection[2];
|
||||
f32 viewX;
|
||||
f32 yOffset;
|
||||
struct DjuiColor textColor;
|
||||
void (*on_enter_press)(struct DjuiInputbox*);
|
||||
void (*on_escape_press)(struct DjuiInputbox*);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@ static void djui_panel_display_framerate_mode_change(UNUSED struct DjuiBase* cal
|
|||
|
||||
static void djui_panel_display_frame_limit_text_change(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
s32 frameLimit = atoi(inputbox1->buffer);
|
||||
if (frameLimit >= 30 && frameLimit <= 3000) {
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox1, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
configFrameLimit = frameLimit;
|
||||
} else {
|
||||
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
#include "djui_panel_options.h"
|
||||
#include "game/level_update.h"
|
||||
|
||||
static struct DjuiFlowLayout* sDynosLayout = NULL;
|
||||
static struct DjuiPaginated* sDynosPaginated = NULL;
|
||||
static struct DjuiInputbox* sSearchInputbox = NULL;
|
||||
|
||||
void djui_panel_dynos_create(struct DjuiBase* caller);
|
||||
|
||||
static void djui_panel_dynos_apply(struct DjuiBase* caller) {
|
||||
|
|
@ -35,27 +39,47 @@ static void djui_panel_dynos_destroy(UNUSED struct DjuiBase* caller) {
|
|||
gDjuiInPlayerMenu = false;
|
||||
}
|
||||
|
||||
static void djui_panel_dynos_add_packs(struct DjuiBase* base) {
|
||||
int packCount = dynos_pack_get_count();
|
||||
for (int i = 0; i < packCount; i++) {
|
||||
if (!dynos_pack_get_exists(i)) continue;
|
||||
bool tmp = dynos_pack_get_enabled(i);
|
||||
const char* pack = dynos_pack_get_name(i);
|
||||
// filter results
|
||||
if (sSearchInputbox != NULL &&
|
||||
sSearchInputbox->buffer != NULL &&
|
||||
!strcasestr(djui_text_get_uncolored_string(NULL, strlen(pack) + 1, pack), sSearchInputbox->buffer)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(base, pack, &tmp, djui_panel_dynos_apply);
|
||||
checkbox1->base.tag = i;
|
||||
checkbox1->base.bTag = tmp;
|
||||
checkbox1->value = &checkbox1->base.bTag;
|
||||
}
|
||||
}
|
||||
|
||||
static void djui_panel_dynos_rebuild_list(UNUSED struct DjuiBase* caller) {
|
||||
djui_base_destroy_children(&sDynosLayout->base);
|
||||
djui_panel_dynos_add_packs(&sDynosLayout->base);
|
||||
djui_paginated_calculate_height(sDynosPaginated);
|
||||
}
|
||||
|
||||
void djui_panel_dynos_create(struct DjuiBase* caller) {
|
||||
gDjuiInPlayerMenu = true;
|
||||
int packCount = dynos_pack_get_count();
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(DYNOS, DYNOS), true);
|
||||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||
|
||||
{
|
||||
struct DjuiSearchbox* searchbox = djui_searchbox_create(body, djui_panel_dynos_rebuild_list);
|
||||
sSearchInputbox = searchbox->inputbox;
|
||||
|
||||
struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
|
||||
struct DjuiBase* layoutBase = &paginated->layout->base;
|
||||
for (int i = 0; i < packCount; i++) {
|
||||
if (dynos_pack_get_exists(i)) {
|
||||
bool tmp = dynos_pack_get_enabled(i);
|
||||
const char* pack = dynos_pack_get_name(i);
|
||||
|
||||
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(layoutBase, pack, &tmp, djui_panel_dynos_apply);
|
||||
checkbox1->base.tag = i;
|
||||
checkbox1->base.bTag = tmp;
|
||||
checkbox1->value = &checkbox1->base.bTag;
|
||||
}
|
||||
}
|
||||
sDynosLayout = paginated->layout;
|
||||
djui_panel_dynos_add_packs(layoutBase);
|
||||
djui_paginated_calculate_height(paginated);
|
||||
sDynosPaginated = paginated;
|
||||
|
||||
struct DjuiRect* space = djui_rect_create(body);
|
||||
djui_base_set_size_type(&space->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE);
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@ static bool djui_panel_host_port_valid(void) {
|
|||
|
||||
static void djui_panel_host_port_text_change(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* sInputboxPort = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (djui_panel_host_port_valid()) {
|
||||
djui_inputbox_set_text_color(sInputboxPort, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(sInputboxPort, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
} else {
|
||||
djui_inputbox_set_text_color(sInputboxPort, 255, 0, 0, 255);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ static struct DjuiText* sTooltip = NULL;
|
|||
static struct DjuiPaginated* sModPaginated = NULL;
|
||||
static struct DjuiButton* sBackButton = NULL;
|
||||
static struct DjuiButton* sRefreshButton = NULL;
|
||||
static struct DjuiInputbox* sSearchInputbox = NULL;
|
||||
static unsigned int sSelectedCategory = MOD_CATEGORY_ALL;
|
||||
static bool sWarned = false;
|
||||
|
||||
|
|
@ -157,6 +158,13 @@ void djui_panel_host_mods_add_mods(struct DjuiBase* layoutBase) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// filter results
|
||||
if (sSearchInputbox != NULL &&
|
||||
sSearchInputbox->buffer != NULL &&
|
||||
!strcasestr(djui_text_get_uncolored_string(NULL, strlen(mod->name) + 1, mod->name), sSearchInputbox->buffer)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
struct DjuiCheckbox* checkbox = djui_checkbox_create(layoutBase, mod->name, &mod->enabled, djui_mod_checkbox_on_value_change);
|
||||
checkbox->base.tag = i;
|
||||
djui_base_set_enabled(&checkbox->base, mod->selectable);
|
||||
|
|
@ -172,7 +180,7 @@ void djui_panel_host_mods_add_mods(struct DjuiBase* layoutBase) {
|
|||
}
|
||||
}
|
||||
|
||||
static void djui_panel_on_categories_change(UNUSED struct DjuiBase* caller) {
|
||||
static void djui_panel_rebuild_mods_list(UNUSED struct DjuiBase* caller) {
|
||||
if (gModRefreshThread.state == RUNNING) { return; }
|
||||
djui_base_destroy_children(&sModLayout->base);
|
||||
djui_panel_host_mods_add_mods(&sModLayout->base);
|
||||
|
|
@ -217,14 +225,15 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
|
|||
|
||||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||
{
|
||||
// copy category choices from sCategories
|
||||
char* categoryChoices[sizeof(sCategories)];
|
||||
struct DjuiSearchbox* searchbox = djui_searchbox_create(body, djui_panel_rebuild_mods_list);
|
||||
sSearchInputbox = searchbox->inputbox;
|
||||
|
||||
// loop thru all categories names, and add those to the categoryChoices string array
|
||||
char* categoryChoices[sizeof(sCategories)];
|
||||
for (int i = 0; i < numCategories; i++) {
|
||||
categoryChoices[i] = djui_language_get("HOST_MOD_CATEGORIES", sCategories[i].langKey);
|
||||
}
|
||||
djui_selectionbox_create(body, DLANG(HOST_MODS, CATEGORIES), categoryChoices, numCategories, &sSelectedCategory, djui_panel_on_categories_change);
|
||||
djui_selectionbox_create(body, DLANG(HOST_MODS, CATEGORIES), categoryChoices, numCategories, &sSelectedCategory, djui_panel_rebuild_mods_list);
|
||||
|
||||
struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
|
||||
paginated->showMaxCount = true;
|
||||
sModLayout = paginated->layout;
|
||||
|
|
@ -242,7 +251,7 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
|
|||
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
||||
}
|
||||
|
||||
panel->bodySize.value = paginated->base.height.value + 64 + 64;
|
||||
panel->bodySize.value = paginated->base.height.value + 64 + 64 + 64;
|
||||
}
|
||||
|
||||
panel->base.destroy = djui_panel_host_mods_destroy;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ static bool djui_panel_host_limit_valid(void) {
|
|||
|
||||
static void djui_panel_host_player_text_change(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (djui_panel_host_limit_valid()) {
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox1, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
} else {
|
||||
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static bool djui_panel_join_direct_ip_parse_port(char** msg) {
|
|||
return port <= 65535;
|
||||
}
|
||||
|
||||
static bool djui_panel_join_direct_ip_valid(char* buffer) {
|
||||
UNUSED static bool djui_panel_join_direct_ip_valid(char* buffer) {
|
||||
char** msg = &buffer;
|
||||
|
||||
if (!djui_panel_join_direct_ip_parse_numbers(msg)) { return false; }
|
||||
|
|
@ -86,8 +86,9 @@ static bool djui_panel_join_direct_ip_valid(char* buffer) {
|
|||
|
||||
static void djui_panel_join_direct_ip_text_change(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (strlen(inputbox1->buffer) > 2) {
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox1, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
} else {
|
||||
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
|
||||
}
|
||||
|
|
@ -107,7 +108,7 @@ static void djui_panel_join_direct_ip_text_set_new(void) {
|
|||
bool is_ipv6 = false;
|
||||
int port = 0;
|
||||
|
||||
// check if address starts with [ (meaning it's a direct IPv6 address.
|
||||
// check if address starts with [ (meaning it's a direct IPv6 address.
|
||||
// This is needed because we need to know when to get the port number. Example: [2001:db8::1000]:7777
|
||||
// If this character is not in the first character in the buffer, it will be treated as an IPv4 address or hostname.
|
||||
if (buffer[0] == '[') {
|
||||
|
|
|
|||
|
|
@ -160,8 +160,9 @@ static char* djui_panel_player_edit_palette_preset_name_get_text(void) {
|
|||
|
||||
static void djui_panel_player_edit_palette_preset_name_text_change(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (djui_panel_player_edit_palette_preset_name_valid(inputbox1->buffer)) {
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox1, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
} else {
|
||||
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
|
||||
}
|
||||
|
|
@ -169,10 +170,11 @@ static void djui_panel_player_edit_palette_preset_name_text_change(struct DjuiBa
|
|||
|
||||
static void djui_panel_player_edit_palette_preset_name_on_focus_end(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (!djui_panel_player_edit_palette_preset_name_valid(inputbox1->buffer)) {
|
||||
djui_inputbox_set_text(inputbox1, djui_panel_player_edit_palette_preset_name_get_text());
|
||||
}
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox1, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
|
||||
djui_inputbox_on_focus_end(&inputbox1->base);
|
||||
}
|
||||
|
|
@ -403,8 +405,9 @@ static char *djui_panel_player_name_default_get(void) {
|
|||
|
||||
static void djui_panel_player_name_text_change(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (network_player_name_valid(inputbox1->buffer)) {
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox1, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
} else {
|
||||
djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255);
|
||||
}
|
||||
|
|
@ -412,11 +415,12 @@ static void djui_panel_player_name_text_change(struct DjuiBase* caller) {
|
|||
|
||||
static void djui_panel_player_name_on_focus_end(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
if (!network_player_name_valid(inputbox1->buffer)) {
|
||||
djui_inputbox_set_text(inputbox1, djui_panel_player_name_default_get());
|
||||
}
|
||||
snprintf(configPlayerName, MAX_CONFIG_STRING, "%s", inputbox1->buffer);
|
||||
djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255);
|
||||
djui_inputbox_set_text_color(inputbox1, theme->interactables.textColor.r, theme->interactables.textColor.g, theme->interactables.textColor.b, theme->interactables.textColor.a);
|
||||
|
||||
if (gNetworkType != NT_NONE) {
|
||||
network_send_player_settings();
|
||||
|
|
|
|||
63
src/pc/djui/djui_searchbox.c
Normal file
63
src/pc/djui/djui_searchbox.c
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "djui.h"
|
||||
|
||||
static void djui_searchbox_destroy(struct DjuiBase* base) {
|
||||
struct DjuiSearchbox* searchbox = (struct DjuiSearchbox*)base;
|
||||
free(searchbox);
|
||||
}
|
||||
|
||||
static void djui_searchbox_on_value_change(struct DjuiBase* base) {
|
||||
struct DjuiInputbox* input = (struct DjuiInputbox*)base;
|
||||
struct DjuiSearchbox* searchbox = (struct DjuiSearchbox*)input->base.parent->parent;
|
||||
|
||||
if (input->buffer[0] != '\0') {
|
||||
djui_base_set_visible(&searchbox->text->base, false);
|
||||
} else {
|
||||
djui_base_set_visible(&searchbox->text->base, true);
|
||||
}
|
||||
|
||||
if (searchbox->on_value_change) {
|
||||
searchbox->on_value_change(base);
|
||||
}
|
||||
}
|
||||
|
||||
struct DjuiSearchbox* djui_searchbox_create(struct DjuiBase* parent, void (*on_value_change)(struct DjuiBase*)) {
|
||||
struct DjuiSearchbox* searchbox = calloc(1, sizeof(struct DjuiSearchbox));
|
||||
struct DjuiBase* base = &searchbox->base;
|
||||
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
|
||||
struct DjuiColor disabledTextColor = theme->interactables.disabledTextColor;
|
||||
|
||||
djui_base_init(parent, base, NULL, djui_searchbox_destroy);
|
||||
|
||||
djui_base_set_size_type(base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(base, 1.0f, 35.0f);
|
||||
|
||||
struct DjuiFlowLayout* searchFlow = djui_flow_layout_create(base);
|
||||
djui_base_set_color(&searchFlow->base, 0, 0, 0, 0);
|
||||
djui_base_set_size_type(&searchFlow->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&searchFlow->base, 1.0f, 35.0f);
|
||||
djui_flow_layout_set_margin(searchFlow, 0);
|
||||
djui_flow_layout_set_flow_direction(searchFlow, DJUI_FLOW_DIR_RIGHT);
|
||||
|
||||
struct DjuiInputbox* searchInputBox = djui_inputbox_create(&searchFlow->base, 64);
|
||||
djui_base_set_alignment(&searchInputBox->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&searchInputBox->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&searchInputBox->base, 1.0f, 35.0f);
|
||||
djui_interactable_hook_value_change(&searchInputBox->base, djui_searchbox_on_value_change);
|
||||
searchInputBox->yOffset = 0;
|
||||
searchbox->inputbox = searchInputBox;
|
||||
|
||||
struct DjuiText* text = djui_text_create(&searchInputBox->base, DLANG(MENU, SEARCH));
|
||||
djui_base_set_color(&text->base, disabledTextColor.r, disabledTextColor.g, disabledTextColor.b, disabledTextColor.a);
|
||||
djui_base_set_alignment(&text->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&text->base, 1.0f, 1.0f);
|
||||
djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
|
||||
djui_text_set_drop_shadow(text, 64, 64, 64, 100);
|
||||
searchbox->text = text;
|
||||
|
||||
searchbox->on_value_change = on_value_change;
|
||||
|
||||
return searchbox;
|
||||
}
|
||||
12
src/pc/djui/djui_searchbox.h
Normal file
12
src/pc/djui/djui_searchbox.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
struct DjuiSearchbox {
|
||||
struct DjuiBase base;
|
||||
struct DjuiText* text;
|
||||
struct DjuiImage* image;
|
||||
struct DjuiInputbox* inputbox;
|
||||
void (*on_value_change)(struct DjuiBase*);
|
||||
};
|
||||
|
||||
struct DjuiSearchbox* djui_searchbox_create(struct DjuiBase* base, void (*on_value_change)(struct DjuiBase*));
|
||||
|
|
@ -7,6 +7,9 @@ static struct DjuiTheme sDjuiThemeLight = {
|
|||
.textColor = {
|
||||
11, 11, 11, 255
|
||||
},
|
||||
.disabledTextColor = {
|
||||
60, 60, 60, 255
|
||||
},
|
||||
|
||||
.defaultRectColor = {
|
||||
222, 222, 222, 255
|
||||
|
|
@ -48,6 +51,9 @@ static struct DjuiTheme sDjuiThemeDark = {
|
|||
.textColor = {
|
||||
220, 220, 220, 255
|
||||
},
|
||||
.disabledTextColor = {
|
||||
140, 140, 140, 255
|
||||
},
|
||||
|
||||
.defaultRectColor = {
|
||||
22, 22, 22, 255
|
||||
|
|
@ -89,6 +95,9 @@ static struct DjuiTheme sDjuiThemeFileSelect = {
|
|||
.textColor = {
|
||||
11, 11, 11, 255
|
||||
},
|
||||
.disabledTextColor = {
|
||||
60, 60, 60, 255
|
||||
},
|
||||
|
||||
.defaultRectColor = {
|
||||
200, 215, 197, 255
|
||||
|
|
@ -130,6 +139,9 @@ static struct DjuiTheme sDjuiThemeMario = {
|
|||
.textColor = {
|
||||
11, 11, 11, 255
|
||||
},
|
||||
.disabledTextColor = {
|
||||
60, 60, 60, 255
|
||||
},
|
||||
|
||||
.defaultRectColor = {
|
||||
255, 227, 0, 255
|
||||
|
|
@ -171,6 +183,9 @@ static struct DjuiTheme sDjuiThemeOdyssey = {
|
|||
.textColor = {
|
||||
11, 11, 11, 255
|
||||
},
|
||||
.disabledTextColor = {
|
||||
60, 60, 60, 255
|
||||
},
|
||||
|
||||
.defaultRectColor = {
|
||||
255, 255, 255, 255
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ enum DjuiThemeType {
|
|||
|
||||
struct DjuiInteractableTheme {
|
||||
struct DjuiColor textColor;
|
||||
struct DjuiColor disabledTextColor;
|
||||
|
||||
struct DjuiColor defaultRectColor;
|
||||
struct DjuiColor cursorDownRectColor;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue