mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
fix player name valid checks
This commit is contained in:
parent
cd5b5f9934
commit
e0ee642f4a
1 changed files with 11 additions and 2 deletions
|
|
@ -338,6 +338,15 @@ static bool djui_panel_player_name_valid(char* buffer) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static char *djui_panel_player_name_default_get(void) {
|
||||
char *langName = DLANG(PLAYER, PLAYER);
|
||||
if (djui_panel_player_name_valid(langName)) {
|
||||
return langName;
|
||||
}
|
||||
static char *name = "Player";
|
||||
return name;
|
||||
}
|
||||
|
||||
static void djui_panel_player_name_text_change(struct DjuiBase* caller) {
|
||||
struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller;
|
||||
if (djui_panel_player_name_valid(inputbox1->buffer)) {
|
||||
|
|
@ -350,7 +359,7 @@ 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;
|
||||
if (!djui_panel_player_name_valid(inputbox1->buffer)) {
|
||||
djui_inputbox_set_text(inputbox1, DLANG(PLAYER, PLAYER));
|
||||
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);
|
||||
|
|
@ -428,7 +437,7 @@ void djui_panel_player_create(struct DjuiBase* caller) {
|
|||
if (djui_panel_player_name_valid(configPlayerName)) {
|
||||
djui_inputbox_set_text(inputbox1, configPlayerName);
|
||||
} else {
|
||||
djui_inputbox_set_text(inputbox1, DLANG(PLAYER, PLAYER));
|
||||
djui_inputbox_set_text(inputbox1, djui_panel_player_name_default_get());
|
||||
}
|
||||
djui_interactable_hook_value_change(&inputbox1->base, djui_panel_player_name_text_change);
|
||||
djui_interactable_hook_focus(&inputbox1->base, djui_inputbox_on_focus_begin, NULL, djui_panel_player_name_on_focus_end);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue