mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Add coop compatbility checkbox to join menu
This commit is contained in:
parent
578995a035
commit
5888c06be9
2 changed files with 41 additions and 0 deletions
|
@ -6,8 +6,19 @@
|
||||||
#include "djui_panel_join_direct.h"
|
#include "djui_panel_join_direct.h"
|
||||||
#include "pc/network/network.h"
|
#include "pc/network/network.h"
|
||||||
#include "pc/utils/misc.h"
|
#include "pc/utils/misc.h"
|
||||||
|
#include "pc/pc_main.h"
|
||||||
|
|
||||||
#ifdef COOPNET
|
#ifdef COOPNET
|
||||||
|
static struct DjuiText* sRestartText = NULL;
|
||||||
|
|
||||||
|
static void djui_panel_compatibility_checkbox_on_value_change(UNUSED struct DjuiBase* caller) {
|
||||||
|
if (gCoopCompatibility != configCoopCompatibility) {
|
||||||
|
djui_text_set_text(sRestartText, DLANG(DISPLAY, MUST_RESTART));
|
||||||
|
} else {
|
||||||
|
djui_text_set_text(sRestartText, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void djui_panel_join_public_lobbies(struct DjuiBase* caller) {
|
static void djui_panel_join_public_lobbies(struct DjuiBase* caller) {
|
||||||
djui_panel_join_lobbies_create(caller, "");
|
djui_panel_join_lobbies_create(caller, "");
|
||||||
}
|
}
|
||||||
|
@ -23,7 +34,14 @@ void djui_panel_join_create(struct DjuiBase* caller) {
|
||||||
djui_button_create(body, DLANG(JOIN, PUBLIC_LOBBIES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_public_lobbies);
|
djui_button_create(body, DLANG(JOIN, PUBLIC_LOBBIES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_public_lobbies);
|
||||||
djui_button_create(body, DLANG(JOIN, PRIVATE_LOBBIES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_private_create);
|
djui_button_create(body, DLANG(JOIN, PRIVATE_LOBBIES), DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_private_create);
|
||||||
djui_button_create(body, DLANG(JOIN, DIRECT), DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_direct_create);
|
djui_button_create(body, DLANG(JOIN, DIRECT), DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_direct_create);
|
||||||
|
djui_checkbox_create(body, DLANG(MISC, COOP_COMPATIBILITY), &configCoopCompatibility, djui_panel_compatibility_checkbox_on_value_change);
|
||||||
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
||||||
|
|
||||||
|
sRestartText = djui_text_create(body, "");
|
||||||
|
djui_text_set_alignment(sRestartText, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP);
|
||||||
|
djui_base_set_color(&sRestartText->base, 255, 100, 100, 255);
|
||||||
|
djui_base_set_size_type(&sRestartText->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
|
djui_base_set_size(&sRestartText->base, 1.0f, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
djui_panel_add(caller, panel, NULL);
|
djui_panel_add(caller, panel, NULL);
|
||||||
|
|
|
@ -15,6 +15,17 @@
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
static struct DjuiInputbox* sInputboxIp = NULL;
|
static struct DjuiInputbox* sInputboxIp = NULL;
|
||||||
|
#ifndef COOPNET
|
||||||
|
static struct DjuiText* sRestartText = NULL;
|
||||||
|
|
||||||
|
static void djui_panel_compatibility_checkbox_on_value_change(UNUSED struct DjuiBase* caller) {
|
||||||
|
if (gCoopCompatibility != configCoopCompatibility) {
|
||||||
|
djui_text_set_text(sRestartText, DLANG(DISPLAY, MUST_RESTART));
|
||||||
|
} else {
|
||||||
|
djui_text_set_text(sRestartText, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool djui_panel_join_direct_ip_parse_numbers(char** msg) {
|
static bool djui_panel_join_direct_ip_parse_numbers(char** msg) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
@ -172,6 +183,10 @@ void djui_panel_join_direct_create(struct DjuiBase* caller) {
|
||||||
sInputboxIp = inputbox1;
|
sInputboxIp = inputbox1;
|
||||||
djui_panel_join_direct_ip_text_set(inputbox1);
|
djui_panel_join_direct_ip_text_set(inputbox1);
|
||||||
|
|
||||||
|
#ifndef COOPNET
|
||||||
|
djui_checkbox_create(body, DLANG(MISC, COOP_COMPATIBILITY), &configCoopCompatibility, djui_panel_compatibility_checkbox_on_value_change);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct DjuiRect* rect2 = djui_rect_container_create(body, 64);
|
struct DjuiRect* rect2 = djui_rect_container_create(body, 64);
|
||||||
{
|
{
|
||||||
struct DjuiButton* button1 = djui_button_create(&rect2->base, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
struct DjuiButton* button1 = djui_button_create(&rect2->base, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
||||||
|
@ -183,6 +198,14 @@ void djui_panel_join_direct_create(struct DjuiBase* caller) {
|
||||||
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||||
defaultBase = &button2->base;
|
defaultBase = &button2->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef COOPNET
|
||||||
|
sRestartText = djui_text_create(body, "");
|
||||||
|
djui_text_set_alignment(sRestartText, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP);
|
||||||
|
djui_base_set_color(&sRestartText->base, 255, 100, 100, 255);
|
||||||
|
djui_base_set_size_type(&sRestartText->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
|
djui_base_set_size(&sRestartText->base, 1.0f, 64);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
djui_panel_add(caller, panel, defaultBase);
|
djui_panel_add(caller, panel, defaultBase);
|
||||||
|
|
Loading…
Reference in a new issue