Continue simplifying DJUI panels

This commit is contained in:
MysterD 2023-03-31 12:34:20 -07:00
parent 2f59539d37
commit abaaf10931
27 changed files with 236 additions and 185 deletions

View file

@ -8,23 +8,23 @@ void djui_panel_camera_value_changed(UNUSED struct DjuiBase* caller) {
} }
void djui_panel_camera_create(struct DjuiBase* caller) { void djui_panel_camera_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\C\\#1be700\\A\\#00b3ff\\M\\#ffef00\\E\\#ff0800\\R\\#1be700\\A"); struct DjuiThreePanel* panel = djui_panel_menu_create("CAMERA");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_checkbox_create(&body->base, "Free Camera", &configEnableCamera, djui_panel_camera_value_changed); djui_checkbox_create(body, "Free Camera", &configEnableCamera, djui_panel_camera_value_changed);
djui_checkbox_create(&body->base, "Analog Camera", &configCameraAnalog, djui_panel_camera_value_changed); djui_checkbox_create(body, "Analog Camera", &configCameraAnalog, djui_panel_camera_value_changed);
#ifdef BETTERCAMERA #ifdef BETTERCAMERA
djui_checkbox_create(&body->base, "Mouse Look", &configCameraMouse, djui_panel_camera_value_changed); djui_checkbox_create(body, "Mouse Look", &configCameraMouse, djui_panel_camera_value_changed);
#endif #endif
djui_checkbox_create(&body->base, "Invert X", &configCameraInvertX, djui_panel_camera_value_changed); djui_checkbox_create(body, "Invert X", &configCameraInvertX, djui_panel_camera_value_changed);
djui_checkbox_create(&body->base, "Invert Y", &configCameraInvertY, djui_panel_camera_value_changed); djui_checkbox_create(body, "Invert Y", &configCameraInvertY, djui_panel_camera_value_changed);
djui_slider_create(&body->base, "X Sensitivity", &configCameraXSens, 1, 100, djui_panel_camera_value_changed); djui_slider_create(body, "X Sensitivity", &configCameraXSens, 1, 100, djui_panel_camera_value_changed);
djui_slider_create(&body->base, "Y Sensitivity", &configCameraYSens, 1, 100, djui_panel_camera_value_changed); djui_slider_create(body, "Y Sensitivity", &configCameraYSens, 1, 100, djui_panel_camera_value_changed);
djui_slider_create(&body->base, "Aggression", &configCameraAggr, 0, 100, djui_panel_camera_value_changed); djui_slider_create(body, "Aggression", &configCameraAggr, 0, 100, djui_panel_camera_value_changed);
djui_slider_create(&body->base, "Pan Level", &configCameraPan, 0, 100, djui_panel_camera_value_changed); djui_slider_create(body, "Pan Level", &configCameraPan, 0, 100, djui_panel_camera_value_changed);
djui_slider_create(&body->base, "Deceleration", &configCameraDegrade, 0, 100, djui_panel_camera_value_changed); djui_slider_create(body, "Deceleration", &configCameraDegrade, 0, 100, djui_panel_camera_value_changed);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -2,19 +2,19 @@
#include "pc/cheats.h" #include "pc/cheats.h"
void djui_panel_cheats_create(struct DjuiBase* caller) { void djui_panel_cheats_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\C\\#1be700\\H\\#00b3ff\\E\\#ffef00\\A\\#ff0800\\T\\#1be700\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("CHEATS");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_checkbox_create(&body->base, "Moon Jump", &gCheats.moonJump, NULL); djui_checkbox_create(body, "Moon Jump", &gCheats.moonJump, NULL);
djui_checkbox_create(&body->base, "God Mode", &gCheats.godMode, NULL); djui_checkbox_create(body, "God Mode", &gCheats.godMode, NULL);
djui_checkbox_create(&body->base, "Infinite Lives", &gCheats.infiniteLives, NULL); djui_checkbox_create(body, "Infinite Lives", &gCheats.infiniteLives, NULL);
djui_checkbox_create(&body->base, "Super Speed", &gCheats.superSpeed, NULL); djui_checkbox_create(body, "Super Speed", &gCheats.superSpeed, NULL);
djui_checkbox_create(&body->base, "Responsive Controls", &gCheats.responsiveControls, NULL); djui_checkbox_create(body, "Responsive Controls", &gCheats.responsiveControls, NULL);
djui_checkbox_create(&body->base, "Rapid Fire (A)", &gCheats.rapidFireA, NULL); djui_checkbox_create(body, "Rapid Fire (A)", &gCheats.rapidFireA, NULL);
djui_checkbox_create(&body->base, "BLJ Anywhere", &gCheats.bljAnywhere, NULL); djui_checkbox_create(body, "BLJ Anywhere", &gCheats.bljAnywhere, NULL);
djui_checkbox_create(&body->base, "Always Triple Jump", &gCheats.alwaysTripleJump, NULL); djui_checkbox_create(body, "Always Triple Jump", &gCheats.alwaysTripleJump, NULL);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -3,15 +3,15 @@
void djui_panel_confirm_create(struct DjuiBase* caller, char* title, char* message, void (*on_yes_click)(struct DjuiBase*)) { void djui_panel_confirm_create(struct DjuiBase* caller, char* title, char* message, void (*on_yes_click)(struct DjuiBase*)) {
struct DjuiThreePanel* panel = djui_panel_menu_create(title); struct DjuiThreePanel* panel = djui_panel_menu_create(title);
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiText* text = djui_text_create(&body->base, message); 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_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&text->base, 1.0f, 64); djui_base_set_size(&text->base, 1.0f, 64);
djui_base_set_color(&text->base, 200, 200, 200, 255); djui_base_set_color(&text->base, 200, 200, 200, 255);
djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER); djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 64); struct DjuiRect* rect1 = djui_rect_container_create(body, 64);
{ {
djui_button_left_create(&rect1->base, "No", DJUI_BUTTON_STYLE_NORMAL, djui_panel_menu_back); djui_button_left_create(&rect1->base, "No", DJUI_BUTTON_STYLE_NORMAL, djui_panel_menu_back);
djui_button_right_create(&rect1->base, "Yes", DJUI_BUTTON_STYLE_NORMAL, on_yes_click); djui_button_right_create(&rect1->base, "Yes", DJUI_BUTTON_STYLE_NORMAL, on_yes_click);

View file

@ -9,12 +9,12 @@ void djui_panel_controls_value_change(UNUSED struct DjuiBase* caller) {
} }
void djui_panel_controls_create(struct DjuiBase* caller) { void djui_panel_controls_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("CONTROLS");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_button_create(&body->base, "N64 Binds", DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_n64_create); djui_button_create(body, "N64 Binds", DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_n64_create);
djui_button_create(&body->base, "Extra Binds", DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_extra_create); djui_button_create(body, "Extra Binds", DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_extra_create);
djui_checkbox_create(&body->base, "Background Gamepad (must restart)", &configBackgroundGamepad, NULL); djui_checkbox_create(body, "Background Gamepad (must restart)", &configBackgroundGamepad, NULL);
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
int numJoys = SDL_NumJoysticks(); int numJoys = SDL_NumJoysticks();
@ -31,13 +31,13 @@ void djui_panel_controls_create(struct DjuiBase* caller) {
sprintf(&gamepadChoicesLong[index], "%d", i); sprintf(&gamepadChoicesLong[index], "%d", i);
gamepadChoices[i] = &gamepadChoicesLong[index]; gamepadChoices[i] = &gamepadChoicesLong[index];
} }
djui_selectionbox_create(&body->base, "Gamepad", gamepadChoices, numJoys, &configGamepadNumber, NULL); djui_selectionbox_create(body, "Gamepad", gamepadChoices, numJoys, &configGamepadNumber, NULL);
#endif #endif
djui_slider_create(&body->base, "Deadzone", &configStickDeadzone, 0, 100, djui_panel_controls_value_change); djui_slider_create(body, "Deadzone", &configStickDeadzone, 0, 100, djui_panel_controls_value_change);
djui_slider_create(&body->base, "Rumble Strength", &configRumbleStrength, 0, 100, djui_panel_controls_value_change); djui_slider_create(body, "Rumble Strength", &configRumbleStrength, 0, 100, djui_panel_controls_value_change);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -4,10 +4,10 @@
void djui_panel_controls_extra_create(struct DjuiBase* caller) { void djui_panel_controls_extra_create(struct DjuiBase* caller) {
f32 bindBodyHeight = 28 * 8 + 1 * 7; f32 bindBodyHeight = 28 * 8 + 1 * 7;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("CONTROLS");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiFlowLayout* bindBody = djui_flow_layout_create(&body->base); struct DjuiFlowLayout* bindBody = djui_flow_layout_create(body);
djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&bindBody->base, 1.0f, bindBodyHeight); djui_base_set_size(&bindBody->base, 1.0f, bindBodyHeight);
djui_base_set_color(&bindBody->base, 0, 0, 0, 0); djui_base_set_color(&bindBody->base, 0, 0, 0, 0);
@ -23,7 +23,7 @@ void djui_panel_controls_extra_create(struct DjuiBase* caller) {
djui_bind_create(&bindBody->base, "Y", configKeyY); djui_bind_create(&bindBody->base, "Y", configKeyY);
} }
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -4,10 +4,10 @@
void djui_panel_controls_n64_create(struct DjuiBase* caller) { void djui_panel_controls_n64_create(struct DjuiBase* caller) {
f32 bindBodyHeight = 28 * 14 + 1 * 13; f32 bindBodyHeight = 28 * 14 + 1 * 13;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("CONTROLS");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiFlowLayout* bindBody = djui_flow_layout_create(&body->base); struct DjuiFlowLayout* bindBody = djui_flow_layout_create(body);
djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&bindBody->base, 1.0f, bindBodyHeight); djui_base_set_size(&bindBody->base, 1.0f, bindBodyHeight);
djui_base_set_color(&bindBody->base, 0, 0, 0, 0); djui_base_set_color(&bindBody->base, 0, 0, 0, 0);
@ -29,7 +29,7 @@ void djui_panel_controls_n64_create(struct DjuiBase* caller) {
djui_bind_create(&bindBody->base, "C Right", configKeyCRight); djui_bind_create(&bindBody->base, "C Right", configKeyCRight);
} }
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -27,20 +27,20 @@ static void djui_panel_display_frame_limit_text_change(struct DjuiBase* caller)
} }
void djui_panel_display_create(struct DjuiBase* caller) { void djui_panel_display_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\D\\#1be700\\I\\#00b3ff\\S\\#ffef00\\P\\#ff0800\\L\\#1be700\\A\\#00b3ff\\Y"); struct DjuiThreePanel* panel = djui_panel_menu_create("DISPLAY");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_checkbox_create(&body->base, "Fullscreen", &configWindow.fullscreen, djui_panel_display_apply); djui_checkbox_create(body, "Fullscreen", &configWindow.fullscreen, djui_panel_display_apply);
#ifdef EXTERNAL_DATA #ifdef EXTERNAL_DATA
djui_checkbox_create(&body->base, "Preload Textures", &configPrecacheRes, NULL); djui_checkbox_create(body, "Preload Textures", &configPrecacheRes, NULL);
#endif #endif
djui_checkbox_create(&body->base, "VSync", &configWindow.vsync, djui_panel_display_apply); djui_checkbox_create(body, "VSync", &configWindow.vsync, djui_panel_display_apply);
djui_checkbox_create(&body->base, "Uncapped Framerate", &configUncappedFramerate, djui_panel_display_apply); djui_checkbox_create(body, "Uncapped Framerate", &configUncappedFramerate, djui_panel_display_apply);
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 32); struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{ {
if (configFrameLimit < 30) { configFrameLimit = 30; } if (configFrameLimit < 30) { configFrameLimit = 30; }
if (configFrameLimit > 3000) { configFrameLimit = 3000; } if (configFrameLimit > 3000) { configFrameLimit = 3000; }
@ -63,19 +63,19 @@ void djui_panel_display_create(struct DjuiBase* caller) {
} }
char* interpChoices[2] = { "Fast", "Accurate" }; char* interpChoices[2] = { "Fast", "Accurate" };
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(&body->base, "Interpolation", interpChoices, 2, &configInterpolationMode, NULL); struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, "Interpolation", interpChoices, 2, &configInterpolationMode, NULL);
djui_base_set_enabled(&selectionbox1->base, (configFrameLimit > 30 || (configFrameLimit <= 30 && configUncappedFramerate))); djui_base_set_enabled(&selectionbox1->base, (configFrameLimit > 30 || (configFrameLimit <= 30 && configUncappedFramerate)));
sInterpolationSelectionBox = selectionbox1; sInterpolationSelectionBox = selectionbox1;
char* filterChoices[3] = { "Nearest", "Linear", "Tripoint" }; char* filterChoices[3] = { "Nearest", "Linear", "Tripoint" };
djui_selectionbox_create(&body->base, "Filtering", filterChoices, 3, &configFiltering, NULL); djui_selectionbox_create(body, "Filtering", filterChoices, 3, &configFiltering, NULL);
char* drawDistanceChoices[6] = { "0.5x", "1x", "1.5x", "3x", "10x", "100x" }; char* drawDistanceChoices[6] = { "0.5x", "1x", "1.5x", "3x", "10x", "100x" };
djui_selectionbox_create(&body->base, "Draw Distance", drawDistanceChoices, 6, &configDrawDistance, NULL); djui_selectionbox_create(body, "Draw Distance", drawDistanceChoices, 6, &configDrawDistance, NULL);
djui_button_create(&body->base, "DynOS Packs", DJUI_BUTTON_STYLE_NORMAL, djui_panel_dynos_create); djui_button_create(body, "DynOS Packs", DJUI_BUTTON_STYLE_NORMAL, djui_panel_dynos_create);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -9,11 +9,11 @@ static void djui_panel_dynos_apply(struct DjuiBase* caller) {
void djui_panel_dynos_create(struct DjuiBase* caller) { void djui_panel_dynos_create(struct DjuiBase* caller) {
int packCount = dynos_pack_get_count(); int packCount = dynos_pack_get_count();
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\D\\#1be700\\Y\\#00b3ff\\N\\#ffef00\\O\\#ff0800\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("DYNOS");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiPaginated* paginated = djui_paginated_create(&body->base, 8); struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
struct DjuiBase* layoutBase = &paginated->layout->base; struct DjuiBase* layoutBase = &paginated->layout->base;
for (int i = 0; i < packCount; i++) { for (int i = 0; i < packCount; i++) {
bool tmp = dynos_pack_get_enabled(i); bool tmp = dynos_pack_get_enabled(i);
@ -26,7 +26,7 @@ void djui_panel_dynos_create(struct DjuiBase* caller) {
} }
djui_paginated_calculate_height(paginated); djui_paginated_calculate_height(paginated);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
panel->bodySize.value = paginated->base.height.value + 16 + 64; panel->bodySize.value = paginated->base.height.value + 16 + 64;
} }

View file

@ -67,20 +67,20 @@ static void djui_panel_host_do_host(struct DjuiBase* caller) {
void djui_panel_host_create(struct DjuiBase* caller) { void djui_panel_host_create(struct DjuiBase* caller) {
struct DjuiBase* defaultBase = NULL; struct DjuiBase* defaultBase = NULL;
struct DjuiThreePanel* panel = djui_panel_menu_create((gNetworkType == NT_SERVER) struct DjuiThreePanel* panel = djui_panel_menu_create((gNetworkType == NT_SERVER)
? "\\#ff0800\\S\\#1be700\\E\\#00b3ff\\R\\#ffef00\\V\\#ff0800\\E\\#1be700\\R" ? "SERVER"
: "\\#ff0800\\H\\#1be700\\O\\#00b3ff\\S\\#ffef00\\T"); : "HOST");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
#ifdef DISCORD_SDK #ifdef DISCORD_SDK
char* nChoices[2] = { "Discord", "Direct Connection" }; char* nChoices[2] = { "Discord", "Direct Connection" };
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(&body->base, "Network system", nChoices, 2, &configNetworkSystem, djui_panel_host_network_system_change); struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, "Network system", nChoices, 2, &configNetworkSystem, djui_panel_host_network_system_change);
if (gNetworkType == NT_SERVER) { if (gNetworkType == NT_SERVER) {
djui_base_set_enabled(&selectionbox1->base, false); djui_base_set_enabled(&selectionbox1->base, false);
} }
#endif #endif
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 32); struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{ {
struct DjuiText* text1 = djui_text_create(&rect1->base, "Port"); struct DjuiText* text1 = djui_text_create(&rect1->base, "Port");
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@ -109,7 +109,7 @@ void djui_panel_host_create(struct DjuiBase* caller) {
sInputboxPort = inputbox1; sInputboxPort = inputbox1;
} }
struct DjuiRect* rect2 = djui_rect_container_create(&body->base, 32); struct DjuiRect* rect2 = djui_rect_container_create(body, 32);
{ {
struct DjuiText* text1 = djui_text_create(&rect2->base, "Save Slot"); struct DjuiText* text1 = djui_text_create(&rect2->base, "Save Slot");
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@ -124,15 +124,15 @@ void djui_panel_host_create(struct DjuiBase* caller) {
djui_base_set_alignment(&button1->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP); djui_base_set_alignment(&button1->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
} }
djui_button_create(&body->base, "Settings", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_settings_create); djui_button_create(body, "Settings", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_settings_create);
struct DjuiButton* button2 = djui_button_create(&body->base, "Mods", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_mods_create); struct DjuiButton* button2 = djui_button_create(body, "Mods", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_mods_create);
button2->base.tag = 0; button2->base.tag = 0;
struct DjuiButton* button3 = djui_button_create(&body->base, "Rom-Hacks", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_mods_create); struct DjuiButton* button3 = djui_button_create(body, "Rom-Hacks", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_mods_create);
button3->base.tag = 1; button3->base.tag = 1;
struct DjuiRect* rect3 = djui_rect_container_create(&body->base, 64); struct DjuiRect* rect3 = djui_rect_container_create(body, 64);
{ {
struct DjuiButton* button1 = djui_button_create(&rect3->base, (gNetworkType == NT_SERVER) ? "Cancel" : "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); struct DjuiButton* button1 = djui_button_create(&rect3->base, (gNetworkType == NT_SERVER) ? "Cancel" : "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
djui_base_set_size(&button1->base, 0.485f, 64); djui_base_set_size(&button1->base, 0.485f, 64);

View file

@ -84,15 +84,15 @@ void djui_panel_host_message_create(struct DjuiBase* caller) {
f32 textHeight = 32 * 0.8125f * warningLines + 8; f32 textHeight = 32 * 0.8125f * warningLines + 8;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\I\\#1be700\\N\\#00b3ff\\F\\#ffef00\\O"); struct DjuiThreePanel* panel = djui_panel_menu_create("INFO");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiText* text1 = djui_text_create(&body->base, warningMessage); struct DjuiText* text1 = djui_text_create(body, warningMessage);
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&text1->base, 1.0f, textHeight); djui_base_set_size(&text1->base, 1.0f, textHeight);
djui_base_set_color(&text1->base, 200, 200, 200, 255); djui_base_set_color(&text1->base, 200, 200, 200, 255);
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 64); struct DjuiRect* rect1 = djui_rect_container_create(body, 64);
{ {
struct DjuiButton* btnHost = djui_button_right_create(&rect1->base, "Host", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_message_do_host); struct DjuiButton* btnHost = djui_button_right_create(&rect1->base, "Host", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_message_do_host);
struct DjuiButton* btnBack = djui_button_left_create(&rect1->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); struct DjuiButton* btnBack = djui_button_left_create(&rect1->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);

View file

@ -90,13 +90,13 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
mods_update_selectable(); mods_update_selectable();
struct DjuiThreePanel* panel = djui_panel_menu_create(isRomHacks ? struct DjuiThreePanel* panel = djui_panel_menu_create(isRomHacks
"\\#ff0800\\R\\#1be700\\O\\#00b3ff\\M \\#ffef00\\H\\#ff0800\\A\\#1be700\\C\\#00b3ff\\K\\#ffef00\\S" : ? "ROMHACKS"
"\\#ff0800\\M\\#1be700\\O\\#00b3ff\\D\\#ffef00\\S" : "MODS"
); );
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiPaginated* paginated = djui_paginated_create(&body->base, 8); struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
sModLayout = paginated->layout; sModLayout = paginated->layout;
struct DjuiBase* layoutBase = &paginated->layout->base; struct DjuiBase* layoutBase = &paginated->layout->base;
for (int i = 0; i < gLocalMods.entryCount; i++) { for (int i = 0; i < gLocalMods.entryCount; i++) {
@ -111,7 +111,7 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
} }
djui_paginated_calculate_height(paginated); djui_paginated_calculate_height(paginated);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
panel->bodySize.value = paginated->base.height.value + 16 + 64; panel->bodySize.value = paginated->base.height.value + 16 + 64;
} }

View file

@ -36,11 +36,11 @@ static void djui_panel_host_save_erase(struct DjuiBase* caller) {
void djui_panel_host_save_create(struct DjuiBase* caller) { void djui_panel_host_save_create(struct DjuiBase* caller) {
sSaveButtonCaller = caller; sSaveButtonCaller = caller;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\S\\#1be700\\A\\#00b3ff\\V\\#ffef00\\E"); struct DjuiThreePanel* panel = djui_panel_menu_create("SAVE");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 32); struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{ {
struct DjuiButton* button1 = djui_button_create(&rect1->base, "", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_save_button_click); struct DjuiButton* button1 = djui_button_create(&rect1->base, "", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_save_button_click);
djui_panel_host_save_update_button(button1, i); djui_panel_host_save_update_button(button1, i);

View file

@ -43,27 +43,27 @@ static void djui_panel_host_player_text_change(struct DjuiBase* caller) {
} }
void djui_panel_host_settings_create(struct DjuiBase* caller) { void djui_panel_host_settings_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\S\\#1be700\\E\\#00b3ff\\T\\#ffef00\\T\\#ff0800\\I\\#1be700\\N\\#00b3ff\\G\\#ffef00\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("SETTINGS");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
char* iChoices[3] = { "Non-solid", "Solid", "Friendly Fire" }; char* iChoices[3] = { "Non-solid", "Solid", "Friendly Fire" };
djui_selectionbox_create(&body->base, "Player interaction", iChoices, 3, &configPlayerInteraction, NULL); djui_selectionbox_create(body, "Player interaction", iChoices, 3, &configPlayerInteraction, NULL);
sKnockbackIndex = (configPlayerKnockbackStrength <= 20) sKnockbackIndex = (configPlayerKnockbackStrength <= 20)
? 0 ? 0
: ((configPlayerKnockbackStrength <= 40) ? 1 : 2); : ((configPlayerKnockbackStrength <= 40) ? 1 : 2);
char* kChoices[3] = { "Weak", "Normal", "Too much" }; char* kChoices[3] = { "Weak", "Normal", "Too much" };
djui_selectionbox_create(&body->base, "Knockback strength", kChoices, 3, &sKnockbackIndex, djui_panel_host_settings_knockback_change); djui_selectionbox_create(body, "Knockback strength", kChoices, 3, &sKnockbackIndex, djui_panel_host_settings_knockback_change);
char* lChoices[3] = { "Leave level", "Stay in level", "Non-stop" }; char* lChoices[3] = { "Leave level", "Stay in level", "Non-stop" };
djui_selectionbox_create(&body->base, "On star collection", lChoices, 3, &configStayInLevelAfterStar, NULL); djui_selectionbox_create(body, "On star collection", lChoices, 3, &configStayInLevelAfterStar, NULL);
djui_checkbox_create(&body->base, "Skip intro cutscene", &configSkipIntro, NULL); djui_checkbox_create(body, "Skip intro cutscene", &configSkipIntro, NULL);
djui_checkbox_create(&body->base, "Share lives", &configShareLives, NULL); djui_checkbox_create(body, "Share lives", &configShareLives, NULL);
djui_checkbox_create(&body->base, "Enable cheats", &configEnableCheats, NULL); djui_checkbox_create(body, "Enable cheats", &configEnableCheats, NULL);
djui_checkbox_create(&body->base, "Bubble on death", &configBubbleDeath, NULL); djui_checkbox_create(body, "Bubble on death", &configBubbleDeath, NULL);
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 32); struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{ {
struct DjuiText* text1 = djui_text_create(&rect1->base, "Amount of players"); struct DjuiText* text1 = djui_text_create(&rect1->base, "Amount of players");
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@ -82,7 +82,7 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) {
sPlayerAmount = inputbox1; sPlayerAmount = inputbox1;
} }
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);
} }

View file

@ -166,33 +166,33 @@ void djui_panel_join_create(struct DjuiBase* caller) {
#endif #endif
struct DjuiBase* defaultBase = NULL; struct DjuiBase* defaultBase = NULL;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\J\\#1be700\\O\\#00b3ff\\I\\#ffef00\\N"); struct DjuiThreePanel* panel = djui_panel_menu_create("JOIN");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
#ifdef DISCORD_SDK #ifdef DISCORD_SDK
struct DjuiText* text1 = djui_text_create(&body->base, sJoiningDiscord); struct DjuiText* text1 = djui_text_create(body, sJoiningDiscord);
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&text1->base, 1.0f, discordTextHeight); djui_base_set_size(&text1->base, 1.0f, discordTextHeight);
djui_base_set_color(&text1->base, 200, 200, 200, 255); djui_base_set_color(&text1->base, 200, 200, 200, 255);
#endif #endif
struct DjuiRect* rect1 = djui_rect_create(&body->base); struct DjuiRect* rect1 = djui_rect_create(body);
djui_base_set_size_type(&rect1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&rect1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&rect1->base, 1.0f, 2); djui_base_set_size(&rect1->base, 1.0f, 2);
djui_base_set_color(&rect1->base, 150, 150, 150, 255); djui_base_set_color(&rect1->base, 150, 150, 150, 255);
struct DjuiText* text2 = djui_text_create(&body->base, sJoiningDirect); struct DjuiText* text2 = djui_text_create(body, sJoiningDirect);
djui_base_set_size_type(&text2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&text2->base, 1.0f, directTextHeight); djui_base_set_size(&text2->base, 1.0f, directTextHeight);
djui_base_set_color(&text2->base, 200, 200, 200, 255); djui_base_set_color(&text2->base, 200, 200, 200, 255);
struct DjuiInputbox* inputbox1 = djui_inputbox_create(&body->base, 256); struct DjuiInputbox* inputbox1 = djui_inputbox_create(body, 256);
djui_base_set_size_type(&inputbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&inputbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&inputbox1->base, 1.0f, 32.0f); djui_base_set_size(&inputbox1->base, 1.0f, 32.0f);
djui_interactable_hook_value_change(&inputbox1->base, djui_panel_join_ip_text_change); djui_interactable_hook_value_change(&inputbox1->base, djui_panel_join_ip_text_change);
sInputboxIp = inputbox1; sInputboxIp = inputbox1;
djui_panel_join_ip_text_set(inputbox1); djui_panel_join_ip_text_set(inputbox1);
struct DjuiRect* rect2 = djui_rect_container_create(&body->base, 64); struct DjuiRect* rect2 = djui_rect_container_create(body, 64);
{ {
struct DjuiButton* button1 = djui_button_create(&rect2->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); struct DjuiButton* button1 = djui_button_create(&rect2->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
djui_base_set_size(&button1->base, 0.485f, 64); djui_base_set_size(&button1->base, 0.485f, 64);

View file

@ -47,10 +47,10 @@ void djui_panel_join_message_create(struct DjuiBase* caller) {
u16 directLines = 8; u16 directLines = 8;
f32 directTextHeight = 32 * 0.8125f * directLines + 8; f32 directTextHeight = 32 * 0.8125f * directLines + 8;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\J\\#1be700\\O\\#00b3ff\\I\\#ffef00\\N\\#1be700\\I\\#00b3ff\\N\\#ffef00\\G"); struct DjuiThreePanel* panel = djui_panel_menu_create("JOINING");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiText* text1 = djui_text_create(&body->base, "..."); struct DjuiText* text1 = djui_text_create(body, "...");
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&text1->base, 1.0f, directTextHeight); djui_base_set_size(&text1->base, 1.0f, directTextHeight);
djui_base_set_color(&text1->base, 200, 200, 200, 255); djui_base_set_color(&text1->base, 200, 200, 200, 255);
@ -60,9 +60,9 @@ void djui_panel_join_message_create(struct DjuiBase* caller) {
sPanelText = text1; sPanelText = text1;
gDownloadProgress = 0; gDownloadProgress = 0;
djui_progress_bar_create(&body->base, &gDownloadProgress, 0.0f, 1.0f); djui_progress_bar_create(body, &gDownloadProgress, 0.0f, 1.0f);
djui_button_create(&body->base, "Cancel", DJUI_BUTTON_STYLE_BACK, djui_panel_join_message_cancel); djui_button_create(body, "Cancel", DJUI_BUTTON_STYLE_BACK, djui_panel_join_message_cancel);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -10,7 +10,7 @@ static void djui_panel_main_quit_yes(UNUSED struct DjuiBase* caller) {
static void djui_panel_main_quit(struct DjuiBase* caller) { static void djui_panel_main_quit(struct DjuiBase* caller) {
djui_panel_confirm_create(caller, djui_panel_confirm_create(caller,
"\\#ff0800\\Q\\#1be700\\U\\#00b3ff\\I\\#ffef00\\T", "QUIT",
"Are you sure you want to quit?", "Are you sure you want to quit?",
djui_panel_main_quit_yes); djui_panel_main_quit_yes);
} }
@ -18,14 +18,14 @@ static void djui_panel_main_quit(struct DjuiBase* caller) {
void djui_panel_main_create(struct DjuiBase* caller) { void djui_panel_main_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP"); struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP");
{ {
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiButton* button1 = djui_button_create(&body->base, "Host", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create); struct DjuiButton* button1 = djui_button_create(body, "Host", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create);
djui_cursor_input_controlled_center(&button1->base); djui_cursor_input_controlled_center(&button1->base);
djui_button_create(&body->base, "Join", DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_create); djui_button_create(body, "Join", DJUI_BUTTON_STYLE_NORMAL, djui_panel_join_create);
djui_button_create(&body->base, "Options", DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_create); djui_button_create(body, "Options", DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_create);
djui_button_create(&body->base, "Quit", DJUI_BUTTON_STYLE_BACK, djui_panel_main_quit); djui_button_create(body, "Quit", DJUI_BUTTON_STYLE_BACK, djui_panel_main_quit);
} }
char* version = get_version_local(); char* version = get_version_local();

View file

@ -1,7 +1,46 @@
#include "djui.h" #include "djui.h"
#include "djui_unicode.h"
#include "src/pc/utils/misc.h" #include "src/pc/utils/misc.h"
#include "src/pc/configfile.h" #include "src/pc/configfile.h"
#define RAINBOW_TEXT_LEN 127
char* sRainbowColors[] = {
"\\#ff0800\\",
"\\#1be700\\",
"\\#00b3ff\\",
"\\#ffef00\\",
};
char sRainbowText[RAINBOW_TEXT_LEN + 1] = { 0 };
static void generate_rainbow_text(char* text) {
char* src = text;
char* dst = sRainbowText;
char tmpChar[10] = { 0 };
int i = 0;
*dst = '\0';
while (*src) {
if (*src == '\\') {
snprintf(sRainbowText, RAINBOW_TEXT_LEN, "%s", text);
return;
}
s32 restrictSize = RAINBOW_TEXT_LEN - (s32)(dst - sRainbowText);
if (restrictSize <= 0) { break; }
snprintf(dst, restrictSize, "%s", sRainbowColors[i++ % 4]);
dst = &sRainbowText[strlen(sRainbowText)];
restrictSize = RAINBOW_TEXT_LEN - (s32)(dst - sRainbowText);
if (restrictSize <= 0) { break; }
djui_unicode_get_char(src, tmpChar);
snprintf(dst, restrictSize, "%s", tmpChar);
dst = &sRainbowText[strlen(sRainbowText)];
src = djui_unicode_next_char(src);
}
}
void djui_panel_menu_back(UNUSED struct DjuiBase* base) { void djui_panel_menu_back(UNUSED struct DjuiBase* base) {
djui_panel_back(); djui_panel_back();
} }
@ -15,7 +54,8 @@ struct DjuiThreePanel* djui_panel_menu_create(char* headerText) {
djui_base_set_border_width(&panel->base, 8); djui_base_set_border_width(&panel->base, 8);
djui_base_set_padding(&panel->base, 16, 16, 16, 16); djui_base_set_padding(&panel->base, 16, 16, 16, 16);
{ {
struct DjuiText* header = djui_text_create(&panel->base, headerText); generate_rainbow_text(headerText);
struct DjuiText* header = djui_text_create(&panel->base, sRainbowText);
djui_base_set_size_type(&header->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&header->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&header->base, 1.0f, 1.0f); djui_base_set_size(&header->base, 1.0f, 1.0f);
djui_base_set_color(&header->base, 255, 8, 0, 255); djui_base_set_color(&header->base, 255, 8, 0, 255);

View file

@ -10,8 +10,8 @@ static void djui_panel_random_menu(UNUSED struct DjuiBase* caller) {
} }
void djui_panel_main_menu_create(struct DjuiBase* caller) { void djui_panel_main_menu_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\M\\#1be700\\A\\#00b3ff\\I\\#ffef00\\N \\#ff0800\\M\\#ff0800\\E\\#1be700\\N\\#ffef00\\U\\#ff0800\\"); struct DjuiThreePanel* panel = djui_panel_menu_create("MAIN MENU");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
char* levelChoices[17] = { char* levelChoices[17] = {
@ -33,15 +33,15 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
"PSS", "PSS",
"TTC", "TTC",
}; };
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(&body->base, "Level", levelChoices, 17, &configMenuLevel, NULL); struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, "Level", levelChoices, 17, &configMenuLevel, NULL);
djui_base_set_enabled(&selectionbox1->base, !configMenuRandom); djui_base_set_enabled(&selectionbox1->base, !configMenuRandom);
sLevelBox = selectionbox1; sLevelBox = selectionbox1;
djui_checkbox_create(&body->base, "Use Stage Music", &configMenuSound, NULL); djui_checkbox_create(body, "Use Stage Music", &configMenuSound, NULL);
djui_checkbox_create(&body->base, "Random Stage", &configMenuRandom, djui_panel_random_menu); djui_checkbox_create(body, "Random Stage", &configMenuRandom, djui_panel_random_menu);
djui_checkbox_create(&body->base, "Play Vanilla Demos", &configMenuDemos, stop_demo); djui_checkbox_create(body, "Play Vanilla Demos", &configMenuDemos, stop_demo);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -5,17 +5,17 @@
#ifdef DEVELOPMENT #ifdef DEVELOPMENT
void djui_panel_options_debug_create(struct DjuiBase* caller) { void djui_panel_options_debug_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\D\\#1be700\\E\\#00b3ff\\B\\#ffef00\\U\\#ff0800\\G"); struct DjuiThreePanel* panel = djui_panel_menu_create("DEBUG");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_checkbox_create(&body->base, "Fixed Collisions", (bool*)&gLevelValues.fixCollisionBugs, NULL); djui_checkbox_create(body, "Fixed Collisions", (bool*)&gLevelValues.fixCollisionBugs, NULL);
djui_checkbox_create(&body->base, "Lua Profiler", &configLuaProfiler, NULL); djui_checkbox_create(body, "Lua Profiler", &configLuaProfiler, NULL);
djui_checkbox_create(&body->base, "Debug Print", &configDebugPrint, NULL); djui_checkbox_create(body, "Debug Print", &configDebugPrint, NULL);
djui_checkbox_create(&body->base, "Debug Info", &configDebugInfo, NULL); djui_checkbox_create(body, "Debug Info", &configDebugInfo, NULL);
djui_checkbox_create(&body->base, "Debug Errors", &configDebugError, NULL); djui_checkbox_create(body, "Debug Errors", &configDebugError, NULL);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);
@ -23,20 +23,20 @@ void djui_panel_options_debug_create(struct DjuiBase* caller) {
#endif #endif
void djui_panel_misc_create(struct DjuiBase* caller) { void djui_panel_misc_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\M\\#1be700\\I\\#00b3ff\\S\\#ffef00\\C"); struct DjuiThreePanel* panel = djui_panel_menu_create("MISC");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_checkbox_create(&body->base, "Pause In Singleplayer", &configSingleplayerPause, NULL); djui_checkbox_create(body, "Pause In Singleplayer", &configSingleplayerPause, NULL);
djui_checkbox_create(&body->base, "Disable Popups", &configDisablePopups, NULL); djui_checkbox_create(body, "Disable Popups", &configDisablePopups, NULL);
djui_button_create(&body->base, "Menu Options", DJUI_BUTTON_STYLE_NORMAL, djui_panel_main_menu_create); djui_button_create(body, "Menu Options", DJUI_BUTTON_STYLE_NORMAL, djui_panel_main_menu_create);
#ifdef DEVELOPMENT #ifdef DEVELOPMENT
djui_button_create(&body->base, "Debug", DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_debug_create); djui_button_create(body, "Debug", DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_debug_create);
#endif #endif
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -20,7 +20,7 @@ void djui_panel_modlist_create(UNUSED struct DjuiBase* caller) {
if (gActiveMods.entryCount == 0) { return; } if (gActiveMods.entryCount == 0) { return; }
f32 bodyHeight = (gActiveMods.entryCount * 32) + (gActiveMods.entryCount - 1) * 4; f32 bodyHeight = (gActiveMods.entryCount * 32) + (gActiveMods.entryCount - 1) * 4;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\M\\#1be700\\O\\#00b3ff\\D\\#ffef00\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("MODS");
djui_three_panel_set_body_size(panel, bodyHeight); djui_three_panel_set_body_size(panel, bodyHeight);
gDjuiModList = panel; gDjuiModList = panel;
@ -33,13 +33,13 @@ void djui_panel_modlist_create(UNUSED struct DjuiBase* caller) {
djui_base_set_size(&panel->base, 280, bodyHeight + (32 + 16) + 32 + 32); djui_base_set_size(&panel->base, 280, bodyHeight + (32 + 16) + 32 + 32);
djui_base_set_visible(&panel->base, false); djui_base_set_visible(&panel->base, false);
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
djui_flow_layout_set_margin(body, 4); djui_flow_layout_set_margin((struct DjuiFlowLayout*)body, 4);
for (int i = 0; i < gActiveMods.entryCount; i++) { for (int i = 0; i < gActiveMods.entryCount; i++) {
struct Mod* mod = gActiveMods.entries[i]; struct Mod* mod = gActiveMods.entries[i];
struct DjuiFlowLayout* row = djui_flow_layout_create(&body->base); struct DjuiFlowLayout* row = djui_flow_layout_create(body);
djui_base_set_size_type(&row->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&row->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&row->base, 1.0f, 32.0f); djui_base_set_size(&row->base, 1.0f, 32.0f);
int v = (i % 2) ? 16 : 32; int v = (i % 2) ? 16 : 32;

View file

@ -8,16 +8,16 @@ void djui_panel_options_back(struct DjuiBase* caller) {
} }
void djui_panel_options_create(struct DjuiBase* caller) { void djui_panel_options_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\O\\#1be700\\P\\#00b3ff\\T\\#ffef00\\I\\#ff0800\\O\\#1be700\\N\\#00b3ff\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("OPTIONS");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_button_create(&body->base, "Player", DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_create); djui_button_create(body, "Player", DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_create);
djui_button_create(&body->base, "Camera", DJUI_BUTTON_STYLE_NORMAL, djui_panel_camera_create); djui_button_create(body, "Camera", DJUI_BUTTON_STYLE_NORMAL, djui_panel_camera_create);
djui_button_create(&body->base, "Controls", DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_create); djui_button_create(body, "Controls", DJUI_BUTTON_STYLE_NORMAL, djui_panel_controls_create);
djui_button_create(&body->base, "Display", DJUI_BUTTON_STYLE_NORMAL, djui_panel_display_create); djui_button_create(body, "Display", DJUI_BUTTON_STYLE_NORMAL, djui_panel_display_create);
djui_button_create(&body->base, "Sound", DJUI_BUTTON_STYLE_NORMAL, djui_panel_sound_create); djui_button_create(body, "Sound", DJUI_BUTTON_STYLE_NORMAL, djui_panel_sound_create);
djui_button_create(&body->base, "Misc", DJUI_BUTTON_STYLE_NORMAL, djui_panel_misc_create); djui_button_create(body, "Misc", DJUI_BUTTON_STYLE_NORMAL, djui_panel_misc_create);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_options_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_options_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -22,12 +22,12 @@ static void djui_panel_pause_quit(struct DjuiBase* caller) {
if (gNetworkType == NT_SERVER) { if (gNetworkType == NT_SERVER) {
djui_panel_confirm_create(caller, djui_panel_confirm_create(caller,
"\\#ff0800\\Q\\#1be700\\U\\#00b3ff\\I\\#ffef00\\T", "QUIT",
"Are you sure you want to stop hosting?", "Are you sure you want to stop hosting?",
djui_panel_pause_quit_yes); djui_panel_pause_quit_yes);
} else { } else {
djui_panel_confirm_create(caller, djui_panel_confirm_create(caller,
"\\#ff0800\\Q\\#1be700\\U\\#00b3ff\\I\\#ffef00\\T", "QUIT",
"Are you sure you want to disconnect?", "Are you sure you want to disconnect?",
djui_panel_pause_quit_yes); djui_panel_pause_quit_yes);
} }
@ -37,33 +37,33 @@ void djui_panel_pause_create(struct DjuiBase* caller) {
if (gDjuiChatBoxFocus) { djui_chat_box_toggle(); } if (gDjuiChatBoxFocus) { djui_chat_box_toggle(); }
struct DjuiBase* defaultBase = NULL; struct DjuiBase* defaultBase = NULL;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\P\\#1be700\\A\\#00b3ff\\U\\#ffef00\\S\\#ff0800\\E"); struct DjuiThreePanel* panel = djui_panel_menu_create("PAUSE");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 64); struct DjuiRect* rect1 = djui_rect_container_create(body, 64);
{ {
djui_button_left_create(&rect1->base, "Player", DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_create); djui_button_left_create(&rect1->base, "Player", DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_create);
djui_button_right_create(&rect1->base, "DynOS Packs", DJUI_BUTTON_STYLE_NORMAL, djui_panel_dynos_create); djui_button_right_create(&rect1->base, "DynOS Packs", DJUI_BUTTON_STYLE_NORMAL, djui_panel_dynos_create);
} }
struct DjuiButton* button3 = djui_button_create(&body->base, "Options", DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_create); struct DjuiButton* button3 = djui_button_create(body, "Options", DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_create);
defaultBase = &button3->base; defaultBase = &button3->base;
if (gServerSettings.enableCheats) { if (gServerSettings.enableCheats) {
djui_button_create(&body->base, "Cheats", DJUI_BUTTON_STYLE_NORMAL, djui_panel_cheats_create); djui_button_create(body, "Cheats", DJUI_BUTTON_STYLE_NORMAL, djui_panel_cheats_create);
} }
if (gNetworkType == NT_SERVER) { if (gNetworkType == NT_SERVER) {
djui_button_create(&body->base, "Server Settings", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create); djui_button_create(body, "Server Settings", DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create);
} }
djui_button_create(&body->base, "Resume", DJUI_BUTTON_STYLE_NORMAL, djui_panel_pause_resume); djui_button_create(body, "Resume", DJUI_BUTTON_STYLE_NORMAL, djui_panel_pause_resume);
if (gNetworkType == NT_SERVER) { if (gNetworkType == NT_SERVER) {
djui_button_create(&body->base, "Stop Hosting", DJUI_BUTTON_STYLE_BACK, djui_panel_pause_quit); djui_button_create(body, "Stop Hosting", DJUI_BUTTON_STYLE_BACK, djui_panel_pause_quit);
} else { } else {
djui_button_create(&body->base, "Disconnect", DJUI_BUTTON_STYLE_BACK, djui_panel_pause_quit); djui_button_create(body, "Disconnect", DJUI_BUTTON_STYLE_BACK, djui_panel_pause_quit);
} }
} }

View file

@ -116,7 +116,7 @@ void djui_panel_player_edit_palette_destroy(struct DjuiBase* caller) {
static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) { static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
char* sPartStrings[PLAYER_PART_MAX] = { "Overalls", "Shirt", "Gloves", "Shoes", "Hair", "Skin", "Cap" }; char* sPartStrings[PLAYER_PART_MAX] = { "Overalls", "Shirt", "Gloves", "Shoes", "Hair", "Skin", "Cap" };
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\P\\#1be700\\A\\#00b3ff\\L\\#ffef00\\E\\#ff0800\\T\\#1be700\\T\\#00b3ff\\E"); struct DjuiThreePanel* panel = djui_panel_menu_create("PALETTE");
// Set current palette to custom when clicking on Edit Palette // Set current palette to custom when clicking on Edit Palette
sPalettePresetIndex = PALETTE_CUSTOM; sPalettePresetIndex = PALETTE_CUSTOM;
@ -128,13 +128,13 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
sSavedDestroy = panel->base.destroy; sSavedDestroy = panel->base.destroy;
panel->base.destroy = djui_panel_player_edit_palette_destroy; panel->base.destroy = djui_panel_player_edit_palette_destroy;
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
sCurrentPlayerPart = SHIRT; sCurrentPlayerPart = SHIRT;
djui_selectionbox_create(&body->base, "Part", sPartStrings, PLAYER_PART_MAX, &sCurrentPlayerPart, djui_panel_player_edit_palette_part_changed); djui_selectionbox_create(body, "Part", sPartStrings, PLAYER_PART_MAX, &sCurrentPlayerPart, djui_panel_player_edit_palette_part_changed);
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 32); struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{ {
struct DjuiText* text1 = djui_text_create(&rect1->base, "Hex Code"); struct DjuiText* text1 = djui_text_create(&rect1->base, "Hex Code");
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@ -152,11 +152,11 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
for (int i = 0; i < 3; i++) sSliderChannels[i] = configCustomPalette.parts[SHIRT][i]; for (int i = 0; i < 3; i++) sSliderChannels[i] = configCustomPalette.parts[SHIRT][i];
sSliderR = djui_slider_create(&body->base, "Red", &sSliderChannels[0], 0, 255, djui_panel_player_edit_palette_red_changed); sSliderR = djui_slider_create(body, "Red", &sSliderChannels[0], 0, 255, djui_panel_player_edit_palette_red_changed);
sSliderG = djui_slider_create(&body->base, "Green", &sSliderChannels[1], 0, 255, djui_panel_player_edit_palette_green_changed); sSliderG = djui_slider_create(body, "Green", &sSliderChannels[1], 0, 255, djui_panel_player_edit_palette_green_changed);
sSliderB = djui_slider_create(&body->base, "Blue", &sSliderChannels[2], 0, 255, djui_panel_player_edit_palette_blue_changed); sSliderB = djui_slider_create(body, "Blue", &sSliderChannels[2], 0, 255, djui_panel_player_edit_palette_blue_changed);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);
@ -231,11 +231,11 @@ void djui_panel_player_create(struct DjuiBase* caller) {
djui_panel_player_prevent_demo(NULL); djui_panel_player_prevent_demo(NULL);
gInPlayerMenu = true; gInPlayerMenu = true;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\P\\#1be700\\L\\#00b3ff\\A\\#ffef00\\Y\\#ff0800\\E\\#1be700\\R"); struct DjuiThreePanel* panel = djui_panel_menu_create("PLAYER");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
struct DjuiRect* rect1 = djui_rect_container_create(&body->base, 32); struct DjuiRect* rect1 = djui_rect_container_create(body, 32);
{ {
struct DjuiText* text1 = djui_text_create(&rect1->base, "Name"); struct DjuiText* text1 = djui_text_create(&rect1->base, "Name");
djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@ -260,7 +260,7 @@ void djui_panel_player_create(struct DjuiBase* caller) {
for (int i = 0; i < CT_MAX; i++) { for (int i = 0; i < CT_MAX; i++) {
modelChoices[i] = gCharacters[i].name; modelChoices[i] = gCharacters[i].name;
} }
djui_selectionbox_create(&body->base, "Model", modelChoices, CT_MAX, &configPlayerModel, djui_panel_player_value_changed); djui_selectionbox_create(body, "Model", modelChoices, CT_MAX, &configPlayerModel, djui_panel_player_value_changed);
char* paletteChoices[PALETTE_PRESET_MAX+1] = { char* paletteChoices[PALETTE_PRESET_MAX+1] = {
"Mario", "Mario",
@ -305,10 +305,10 @@ void djui_panel_player_create(struct DjuiBase* caller) {
} }
} }
sPalettePresetSelection = djui_selectionbox_create(&body->base, "Palette Preset", paletteChoices, PALETTE_PRESET_MAX+1, &sPalettePresetIndex, djui_panel_player_value_changed); sPalettePresetSelection = djui_selectionbox_create(body, "Palette Preset", paletteChoices, PALETTE_PRESET_MAX+1, &sPalettePresetIndex, djui_panel_player_value_changed);
djui_button_create(&body->base, "Edit Palette", DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_edit_palette_create); djui_button_create(body, "Edit Palette", DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_edit_palette_create);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
struct DjuiPanel* p = djui_panel_add(caller, panel, NULL); struct DjuiPanel* p = djui_panel_add(caller, panel, NULL);

View file

@ -66,7 +66,7 @@ void djui_panel_playerlist_on_render_pre(UNUSED struct DjuiBase* base, UNUSED bo
void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) { void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) {
f32 bodyHeight = (MAX_PLAYERS * 32) + (MAX_PLAYERS - 1) * 4; f32 bodyHeight = (MAX_PLAYERS * 32) + (MAX_PLAYERS - 1) * 4;
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\P\\#1be700\\L\\#00b3ff\\A\\#ffef00\\Y\\#ff0800\\E\\#1be700\\R\\#00b3ff\\S"); struct DjuiThreePanel* panel = djui_panel_menu_create("PLAYERS");
djui_three_panel_set_body_size(panel, bodyHeight); djui_three_panel_set_body_size(panel, bodyHeight);
gDjuiPlayerList = panel; gDjuiPlayerList = panel;
panel->base.on_render_pre = djui_panel_playerlist_on_render_pre; panel->base.on_render_pre = djui_panel_playerlist_on_render_pre;
@ -74,11 +74,11 @@ void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) {
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&panel->base, 710, bodyHeight + (32 + 16) + 32 + 32); djui_base_set_size(&panel->base, 710, bodyHeight + (32 + 16) + 32 + 32);
djui_base_set_visible(&panel->base, false); djui_base_set_visible(&panel->base, false);
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
djui_flow_layout_set_margin(body, 4); djui_flow_layout_set_margin((struct DjuiFlowLayout*)body, 4);
for (s32 i = 0; i < MAX_PLAYERS; i++) { for (s32 i = 0; i < MAX_PLAYERS; i++) {
struct DjuiFlowLayout* row = djui_flow_layout_create(&body->base); struct DjuiFlowLayout* row = djui_flow_layout_create(body);
djui_base_set_size_type(&row->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size_type(&row->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&row->base, 1.0f, 32.0f); djui_base_set_size(&row->base, 1.0f, 32.0f);
int v = (i % 2) ? 16 : 32; int v = (i % 2) ? 16 : 32;

View file

@ -3,15 +3,15 @@
#include "src/pc/configfile.h" #include "src/pc/configfile.h"
void djui_panel_sound_create(struct DjuiBase* caller) { void djui_panel_sound_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create("\\#ff0800\\S\\#1be700\\O\\#00b3ff\\U\\#ffef00\\N\\#ff0800\\D"); struct DjuiThreePanel* panel = djui_panel_menu_create("SOUND");
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
{ {
djui_slider_create(&body->base, "Master Volume", &configMasterVolume, 0, 127, NULL); djui_slider_create(body, "Master Volume", &configMasterVolume, 0, 127, NULL);
djui_slider_create(&body->base, "Music Volume", &configMusicVolume, 0, 127, NULL); djui_slider_create(body, "Music Volume", &configMusicVolume, 0, 127, NULL);
djui_slider_create(&body->base, "Sfx Volume", &configSfxVolume, 0, 127, NULL); djui_slider_create(body, "Sfx Volume", &configSfxVolume, 0, 127, NULL);
djui_slider_create(&body->base, "Env Volume", &configEnvVolume, 0, 127, NULL); djui_slider_create(body, "Env Volume", &configEnvVolume, 0, 127, NULL);
djui_button_create(&body->base, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, "Back", DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);

View file

@ -257,3 +257,13 @@ char djui_unicode_get_base_char(char* text) {
struct SmCodeGlyph* glyph = hmap_get(sCharMap, key); struct SmCodeGlyph* glyph = hmap_get(sCharMap, key);
return (glyph != NULL) ? glyph->base : '?'; return (glyph != NULL) ? glyph->base : '?';
} }
void djui_unicode_get_char(char* text, char* output) {
s32 bytes = count_bytes_for_char(text);
while (bytes-- > 0) {
*output = *text;
output++;
text++;
}
*output = '\0';
}

View file

@ -12,3 +12,4 @@ size_t djui_unicode_len(char* text);
bool djui_unicode_valid_char(char* text); bool djui_unicode_valid_char(char* text);
void djui_unicode_cleanup_end(char* text); void djui_unicode_cleanup_end(char* text);
char djui_unicode_get_base_char(char* text); char djui_unicode_get_base_char(char* text);
void djui_unicode_get_char(char* text, char* output);