mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 12:05:11 +00:00
DJUI: Added host menu
Added host message menu Refactored how panel menus are constructed Adjusted normal font's line height Adjusted how text boxes detect max lines
This commit is contained in:
parent
4504b2c21b
commit
8b7ab3c35c
24 changed files with 445 additions and 352 deletions
|
@ -3947,6 +3947,9 @@
|
|||
<ClCompile Include="..\src\pc\djui\djui_button.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_checkbox.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_controls.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_host.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_host_message.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_menu.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_selectionbox.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_cursor.c" />
|
||||
<ClCompile Include="..\src\pc\djui\djui_flow_layout.c" />
|
||||
|
@ -4385,6 +4388,9 @@
|
|||
<ClInclude Include="..\src\pc\djui\djui_button.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_checkbox.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_controls.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_host.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_host_message.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_menu.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_selectionbox.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_cursor.h" />
|
||||
<ClInclude Include="..\src\pc\djui\djui_flow_layout.h" />
|
||||
|
|
|
@ -15240,6 +15240,15 @@
|
|||
<ClCompile Include="..\src\pc\djui\djui_bind.c">
|
||||
<Filter>Source Files\src\pc\djui\component\compound</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_host.c">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_menu.c">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pc\djui\djui_panel_host_message.c">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\actors\common0.h">
|
||||
|
@ -16300,5 +16309,14 @@
|
|||
<ClInclude Include="..\src\pc\djui\djui_bind.h">
|
||||
<Filter>Source Files\src\pc\djui\component\compound</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_host.h">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_menu.h">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\pc\djui\djui_panel_host_message.h">
|
||||
<Filter>Source Files\src\pc\djui\panel</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -104,7 +104,7 @@ unsigned int configHostPort = DEFAULT_PORT;
|
|||
unsigned int configHostSaveSlot = 1;
|
||||
unsigned int configPlayerInteraction = 1;
|
||||
unsigned int configPlayerKnockbackStrength = 25;
|
||||
unsigned int configStayInLevelAfterStar = 0;
|
||||
bool configStayInLevelAfterStar = 0;
|
||||
unsigned int configNetworkSystem = 0;
|
||||
bool configLuigiSounds = true;
|
||||
|
||||
|
@ -164,7 +164,7 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "coop_host_save_slot", .type = CONFIG_TYPE_UINT , .uintValue = &configHostSaveSlot},
|
||||
{.name = "coop_player_interaction", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerInteraction},
|
||||
{.name = "coop_player_knockback_strength", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerKnockbackStrength},
|
||||
{.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar},
|
||||
{.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .boolValue = &configStayInLevelAfterStar},
|
||||
{.name = "coop_network_system", .type = CONFIG_TYPE_UINT , .uintValue = &configNetworkSystem},
|
||||
{.name = "coop_luigi_sounds", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuigiSounds},
|
||||
};
|
||||
|
|
|
@ -70,7 +70,7 @@ extern unsigned int configHostPort;
|
|||
extern unsigned int configHostSaveSlot;
|
||||
extern unsigned int configPlayerInteraction;
|
||||
extern unsigned int configPlayerKnockbackStrength;
|
||||
extern unsigned int configStayInLevelAfterStar;
|
||||
extern bool configStayInLevelAfterStar;
|
||||
extern unsigned int configNetworkSystem;
|
||||
extern bool configLuigiSounds;
|
||||
|
||||
|
|
|
@ -28,8 +28,11 @@
|
|||
#include "djui_bind.h"
|
||||
|
||||
#include "djui_panel.h"
|
||||
#include "djui_panel_menu.h"
|
||||
#include "djui_panel_debug.h"
|
||||
#include "djui_panel_main.h"
|
||||
#include "djui_panel_host.h"
|
||||
#include "djui_panel_host_message.h"
|
||||
#include "djui_panel_options.h"
|
||||
#include "djui_panel_camera.h"
|
||||
#include "djui_panel_controls.h"
|
||||
|
|
|
@ -64,7 +64,7 @@ struct DjuiCheckbox* djui_checkbox_create(struct DjuiBase* parent, const char* m
|
|||
struct DjuiText* text = djui_text_create(&checkbox->base, message);
|
||||
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, 0.5f, 1.0f);
|
||||
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, 120, 120, 120, 64);
|
||||
checkbox->text = text;
|
||||
|
|
|
@ -56,7 +56,7 @@ static f32 djui_font_normal_char_width(char c) {
|
|||
static const struct DjuiFont sDjuiFontNormal = {
|
||||
.charWidth = 0.5f,
|
||||
.charHeight = 1.0f,
|
||||
.lineHeight = 0.8f,
|
||||
.lineHeight = 0.8125f,
|
||||
.defaultFontScale = 32.0f,
|
||||
.rotatedUV = true,
|
||||
.textBeginDisplayList = djui_font_normal_text_begin,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
#define DJUI_DEFAULT_PANEL_WIDTH (400.0f + (16 * 2.0f))
|
||||
#define DJUI_PANEL_HEADER_OFFSET (-8)
|
||||
|
||||
void djui_panel_add(struct DjuiBase* caller, struct DjuiBase* panelBase, struct DjuiBase* defaultElementBase);
|
||||
void djui_panel_back(void);
|
||||
void djui_panel_update(void);
|
||||
|
|
|
@ -2,42 +2,18 @@
|
|||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
static void djui_panel_camera_back(struct DjuiBase* base) {
|
||||
djui_panel_back();
|
||||
}
|
||||
|
||||
void djui_panel_camera_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 32 * 10 + 64 * 1 + 16 * 10;
|
||||
|
||||
struct DjuiCheckbox* checkbox1 = NULL;
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\C\\#1be700\\A\\#00b3ff\\M\\#ffef00\\E\\#ff0800\\R\\#1be700\\A");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, 340.0f + (16 * 2.0f), 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, "\\#ff0800\\C\\#1be700\\A\\#00b3ff\\M\\#ffef00\\E\\#ff0800\\R\\#1be700\\A");
|
||||
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_color(&header->base, 255, 8, 0, 255);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
djui_flow_layout_set_flow_direction(body, DJUI_FLOW_DIR_DOWN);
|
||||
{
|
||||
checkbox1 = djui_checkbox_create(&body->base, "Free Camera", &configEnableCamera);
|
||||
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, "Free Camera", &configEnableCamera);
|
||||
djui_base_set_size_type(&checkbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&checkbox1->base, 1.0f, 32);
|
||||
defaultBase = &checkbox1->base;
|
||||
|
||||
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(&body->base, "Analog Camera", &configCameraAnalog);
|
||||
djui_base_set_size_type(&checkbox2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
@ -78,9 +54,8 @@ void djui_panel_camera_create(struct DjuiBase* caller) {
|
|||
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_camera_back);
|
||||
}
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_menu_back);
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, &checkbox1->base);
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
||||
|
|
|
@ -2,38 +2,13 @@
|
|||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
static void djui_panel_controls_back(struct DjuiBase* base) {
|
||||
djui_panel_back();
|
||||
}
|
||||
|
||||
void djui_panel_controls_create(struct DjuiBase* caller) {
|
||||
f32 bindBodyHeight = 32 * 11 + 1 * 10;
|
||||
f32 bodyHeight = bindBodyHeight + 16 * 3 + 32 * 2 + 64;
|
||||
|
||||
struct DjuiBind* bind1 = NULL;
|
||||
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, 340.0f + (16 * 2.0f), 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, "\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S");
|
||||
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_color(&header->base, 255, 8, 0, 255);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\C\\#1be700\\O\\#00b3ff\\N\\#ffef00\\T\\#ff0800\\R\\#1be700\\O\\#00b3ff\\L\\#ffef00\\S");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
struct DjuiFlowLayout* bindBody = djui_flow_layout_create(&body->base);
|
||||
djui_base_set_size_type(&bindBody->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
@ -41,7 +16,7 @@ void djui_panel_controls_create(struct DjuiBase* caller) {
|
|||
djui_base_set_color(&bindBody->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(bindBody, 1);
|
||||
{
|
||||
bind1 = djui_bind_create(&bindBody->base, "A", configKeyA);
|
||||
struct DjuiBind* bind1 = djui_bind_create(&bindBody->base, "A", configKeyA);
|
||||
struct DjuiBind* bind2 = djui_bind_create(&bindBody->base, "B", configKeyB);
|
||||
struct DjuiBind* bind3 = djui_bind_create(&bindBody->base, "Start", configKeyStart);
|
||||
struct DjuiBind* bind4 = djui_bind_create(&bindBody->base, "L", configKeyL);
|
||||
|
@ -52,6 +27,7 @@ void djui_panel_controls_create(struct DjuiBase* caller) {
|
|||
struct DjuiBind* bind9 = djui_bind_create(&bindBody->base, "C Left", configKeyCLeft);
|
||||
struct DjuiBind* bind10 = djui_bind_create(&bindBody->base, "C Right", configKeyCRight);
|
||||
struct DjuiBind* bind11 = djui_bind_create(&bindBody->base, "Chat", configKeyChat);
|
||||
defaultBase = &bind1->buttons[0]->base;
|
||||
}
|
||||
|
||||
struct DjuiSlider* slider1 = djui_slider_create(&body->base, "Deadzone", &configStickDeadzone, 0, 100);
|
||||
|
@ -65,9 +41,8 @@ void djui_panel_controls_create(struct DjuiBase* caller) {
|
|||
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_controls_back);
|
||||
}
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_menu_back);
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, &bind1->base);
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
static void djui_panel_display_back(struct DjuiBase* base) {
|
||||
djui_panel_back();
|
||||
}
|
||||
|
||||
static void djui_panel_display_apply(struct DjuiBase* caller) {
|
||||
configWindow.settings_changed = true;
|
||||
}
|
||||
|
@ -13,36 +9,16 @@ static void djui_panel_display_apply(struct DjuiBase* caller) {
|
|||
void djui_panel_display_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 32 * 5 + 64 * 1 + 16 * 4;
|
||||
|
||||
struct DjuiCheckbox* checkbox1 = NULL;
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\I\\#00b3ff\\S\\#ffef00\\P\\#ff0800\\L\\#1be700\\A\\#00b3ff\\Y");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, 340.0f + (16 * 2.0f), 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, "\\#ff0800\\D\\#1be700\\I\\#00b3ff\\S\\#ffef00\\P\\#ff0800\\L\\#1be700\\A\\#00b3ff\\Y");
|
||||
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_color(&header->base, 255, 8, 0, 255);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
djui_flow_layout_set_flow_direction(body, DJUI_FLOW_DIR_DOWN);
|
||||
{
|
||||
checkbox1 = djui_checkbox_create(&body->base, "Fullscreen", &configWindow.fullscreen);
|
||||
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, "Fullscreen", &configWindow.fullscreen);
|
||||
djui_base_set_size_type(&checkbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&checkbox1->base, 1.0f, 32);
|
||||
djui_interactable_hook_value_change(&checkbox1->base, djui_panel_display_apply);
|
||||
defaultBase = &checkbox1->base;
|
||||
|
||||
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(&body->base, "VSync", &configWindow.vsync);
|
||||
djui_base_set_size_type(&checkbox2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
@ -61,9 +37,8 @@ void djui_panel_display_create(struct DjuiBase* caller) {
|
|||
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_display_back);
|
||||
}
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_menu_back);
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, &checkbox1->base);
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
||||
|
|
60
src/pc/djui/djui_panel_host.c
Normal file
60
src/pc/djui/djui_panel_host.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include "djui.h"
|
||||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
void djui_panel_host_create(struct DjuiBase* caller) {
|
||||
#ifdef DISCORD_SDK
|
||||
f32 bodyHeight = 32 * 4 + 64 * 2 + 16 * 6;
|
||||
#else
|
||||
f32 bodyHeight = 32 * 3 + 64 * 2 + 16 * 5;
|
||||
#endif
|
||||
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\H\\#1be700\\O\\#00b3ff\\S\\#ffef00\\T");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
#ifdef DISCORD_SDK
|
||||
char* nChoices[2] = { "Discord", "Direct Connection" };
|
||||
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(&body->base, "Network system", nChoices, 2, &configNetworkSystem);
|
||||
djui_base_set_size_type(&selectionbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&selectionbox1->base, 1.0f, 32);
|
||||
#endif
|
||||
char* iChoices[3] = { "Non-solid", "Solid", "Friendly Fire" };
|
||||
struct DjuiSelectionbox* selectionbox2 = djui_selectionbox_create(&body->base, "Player interaction", iChoices, 3, &configFiltering);
|
||||
djui_base_set_size_type(&selectionbox2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&selectionbox2->base, 1.0f, 32);
|
||||
|
||||
struct DjuiCheckbox* checkbox1 = djui_checkbox_create(&body->base, "Stay in level after star", &configStayInLevelAfterStar);
|
||||
djui_base_set_size_type(&checkbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&checkbox1->base, 1.0f, 32);
|
||||
|
||||
struct DjuiCheckbox* checkbox2 = djui_checkbox_create(&body->base, "Play intro cutscene", &configSkipIntro);
|
||||
djui_base_set_size_type(&checkbox2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&checkbox2->base, 1.0f, 32);
|
||||
|
||||
struct DjuiCheckbox* checkbox3 = djui_checkbox_create(&body->base, "Share lives", &configShareLives);
|
||||
djui_base_set_size_type(&checkbox3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&checkbox3->base, 1.0f, 32);
|
||||
|
||||
struct DjuiRect* rect1 = djui_rect_create(&body->base);
|
||||
djui_base_set_size_type(&rect1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&rect1->base, 1.0f, 64);
|
||||
djui_base_set_color(&rect1->base, 0, 0, 0, 0);
|
||||
{
|
||||
struct DjuiButton* button1 = djui_button_create(&rect1->base, "Back");
|
||||
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button1->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button1->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button1->base, djui_panel_menu_back);
|
||||
|
||||
struct DjuiButton* button2 = djui_button_create(&rect1->base, "Host");
|
||||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button2->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_host_message_create);
|
||||
defaultBase = &button2->base;
|
||||
}
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
4
src/pc/djui/djui_panel_host.h
Normal file
4
src/pc/djui/djui_panel_host.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
void djui_panel_host_create(struct DjuiBase* caller);
|
76
src/pc/djui/djui_panel_host_message.c
Normal file
76
src/pc/djui/djui_panel_host_message.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
#include <stdio.h>
|
||||
#include "djui.h"
|
||||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
#ifdef DISCORD_SDK
|
||||
static char* sWarningDiscord = "\
|
||||
Invite friends by right clicking their name on Discord and clicking on\n\
|
||||
'\\#d0d0ff\\Invite to Game\\#c8c8c8\\'.\n\n\
|
||||
You can invite channels of servers as well by clicking the \\#d0d0ff\\plus\\#c8c8c8\\ button next to the place where you enter chat.\n\n\
|
||||
Game Activity \\#ffa0a0\\must be\\#c8c8c8\\ enabled in your\nDiscord user settings.\n\n\
|
||||
Appearing offline \\#ffa0a0\\will prevent\\#c8c8c8\\ invites from being sent.\
|
||||
";
|
||||
#endif
|
||||
|
||||
static char* sWarningSocket = "\
|
||||
Direct connections \\#ffa0a0\\require you\\#c8c8c8\\ to configure port forwarding in your router.\n\n\
|
||||
Forward port '\\#d0d0ff\\%d\\#c8c8c8\\' for UDP.\
|
||||
";
|
||||
|
||||
void djui_panel_host_message_create(struct DjuiBase* caller) {
|
||||
f32 warningLines = 0;
|
||||
char* warningMessage = NULL;
|
||||
|
||||
#ifdef DISCORD_SDK
|
||||
if (!configNetworkSystem) {
|
||||
warningLines = 13;
|
||||
warningMessage = sWarningDiscord;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
warningLines = 5;
|
||||
warningMessage = malloc(sizeof(char) * 256);
|
||||
sprintf(warningMessage, sWarningSocket, configHostPort);
|
||||
}
|
||||
|
||||
f32 textHeight = 32 * 0.8125f * warningLines + 8;
|
||||
f32 bodyHeight = textHeight + 16 + 64;
|
||||
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\I\\#1be700\\N\\#00b3ff\\F\\#ffef00\\O");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
struct DjuiText* text1 = djui_text_create(&body->base, warningMessage);
|
||||
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_color(&text1->base, 200, 200, 200, 255);
|
||||
|
||||
struct DjuiRect* rect1 = djui_rect_create(&body->base);
|
||||
djui_base_set_size_type(&rect1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&rect1->base, 1.0f, 64);
|
||||
djui_base_set_color(&rect1->base, 0, 0, 0, 0);
|
||||
{
|
||||
struct DjuiButton* button1 = djui_button_create(&rect1->base, "Back");
|
||||
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button1->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button1->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button1->base, djui_panel_menu_back);
|
||||
|
||||
struct DjuiButton* button2 = djui_button_create(&rect1->base, "Host");
|
||||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button2->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_menu_back);
|
||||
defaultBase = &button2->base;
|
||||
}
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
#ifdef DISCORD_SDK
|
||||
if (configNetworkSystem)
|
||||
#endif
|
||||
{
|
||||
free(warningMessage);
|
||||
}
|
||||
}
|
4
src/pc/djui/djui_panel_host_message.h
Normal file
4
src/pc/djui/djui_panel_host_message.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
void djui_panel_host_message_create(struct DjuiBase* caller);
|
|
@ -10,34 +10,17 @@ static void djui_panel_main_close(struct DjuiBase* caller) {
|
|||
void djui_panel_main_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 64 * 4 + 16 * 3;
|
||||
|
||||
struct DjuiButton* buttonHost = NULL;
|
||||
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 128, bodyHeight, 32);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, 340.0f + (16 * 2.0f), 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP");
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP");
|
||||
djui_base_set_color(&header->base, 255, 8, 0, 255);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
djui_flow_layout_set_flow_direction(body, DJUI_FLOW_DIR_DOWN);
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
buttonHost = djui_button_create(&body->base, "Host");
|
||||
djui_base_set_size_type(&buttonHost->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&buttonHost->base, 1.0f, 64);
|
||||
djui_cursor_input_controlled_center(&buttonHost->base);
|
||||
djui_interactable_hook_click(&buttonHost->base, djui_panel_main_close);
|
||||
struct DjuiButton* button1 = djui_button_create(&body->base, "Host");
|
||||
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button1->base, 1.0f, 64);
|
||||
djui_cursor_input_controlled_center(&button1->base);
|
||||
djui_interactable_hook_click(&button1->base, djui_panel_host_create);
|
||||
defaultBase = &button1->base;
|
||||
|
||||
struct DjuiButton* button2 = djui_button_create(&body->base, "Join");
|
||||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
@ -59,9 +42,9 @@ void djui_panel_main_create(struct DjuiBase* caller) {
|
|||
djui_base_set_size_type(&footer->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&footer->base, 1.0f, 1.0f);
|
||||
djui_base_set_color(&footer->base, 50, 50, 50, 255);
|
||||
djui_text_set_alignment(footer, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_alignment(footer, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM);
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, &buttonHost->base);
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
gInteractableOverridePad = true;
|
||||
}
|
||||
|
|
36
src/pc/djui/djui_panel_menu.c
Normal file
36
src/pc/djui/djui_panel_menu.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include "djui.h"
|
||||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
void djui_panel_menu_back(struct DjuiBase* base) {
|
||||
djui_panel_back();
|
||||
}
|
||||
|
||||
struct DjuiThreePanel* djui_panel_menu_create(f32 bodyHeight, char* headerText) {
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, DJUI_DEFAULT_PANEL_WIDTH, 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, headerText);
|
||||
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_color(&header->base, 255, 8, 0, 255);
|
||||
djui_base_set_location(&header->base, 0, DJUI_PANEL_HEADER_OFFSET);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
djui_flow_layout_set_flow_direction(body, DJUI_FLOW_DIR_DOWN);
|
||||
}
|
||||
return panel;
|
||||
}
|
5
src/pc/djui/djui_panel_menu.h
Normal file
5
src/pc/djui/djui_panel_menu.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
void djui_panel_menu_back(struct DjuiBase* base);
|
||||
struct DjuiThreePanel* djui_panel_menu_create(f32 bodyHeight, char* headerText);
|
|
@ -1,42 +1,17 @@
|
|||
#include "djui.h"
|
||||
#include "src/pc/utils/misc.h"
|
||||
|
||||
static void djui_panel_options_back(struct DjuiBase* base) {
|
||||
djui_panel_back();
|
||||
}
|
||||
|
||||
void djui_panel_options_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 64 * 6 + 16 * 5;
|
||||
|
||||
struct DjuiButton* buttonPlayer = NULL;
|
||||
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, 340.0f + (16 * 2.0f), 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\O\\#1be700\\P\\#00b3ff\\T\\#ffef00\\I\\#ff0800\\O\\#1be700\\N\\#00b3ff\\S");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, "\\#ff0800\\O\\#1be700\\P\\#00b3ff\\T\\#ffef00\\I\\#ff0800\\O\\#1be700\\N\\#00b3ff\\S");
|
||||
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_color(&header->base, 255, 8, 0, 255);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
djui_flow_layout_set_flow_direction(body, DJUI_FLOW_DIR_DOWN);
|
||||
{
|
||||
buttonPlayer = djui_button_create(&body->base, "Player");
|
||||
djui_base_set_size_type(&buttonPlayer->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&buttonPlayer->base, 1.0f, 64);
|
||||
struct DjuiButton* button1 = djui_button_create(&body->base, "Player");
|
||||
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button1->base, 1.0f, 64);
|
||||
defaultBase = &button1->base;
|
||||
|
||||
struct DjuiButton* button2 = djui_button_create(&body->base, "Camera");
|
||||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
@ -61,9 +36,8 @@ void djui_panel_options_create(struct DjuiBase* caller) {
|
|||
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_options_back);
|
||||
}
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_menu_back);
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, &buttonPlayer->base);
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
||||
|
|
|
@ -10,34 +10,11 @@ static void djui_panel_quit_no(struct DjuiBase* base) {
|
|||
}
|
||||
|
||||
void djui_panel_quit_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 64 * 3 + 16 * 2;
|
||||
f32 bodyHeight = 64 * 2 + 16 * 1;
|
||||
|
||||
struct DjuiButton* buttonNo = NULL;
|
||||
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, 340.0f + (16 * 2.0f), 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 230);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
djui_base_set_enabled(&panel->base, false);
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, "\\#ff0800\\Q\\#1be700\\U\\#00b3ff\\I\\#ffef00\\T");
|
||||
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_color(&header->base, 255, 8, 0, 255);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
djui_flow_layout_set_flow_direction(body, DJUI_FLOW_DIR_DOWN);
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\Q\\#1be700\\U\\#00b3ff\\I\\#ffef00\\T");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
{
|
||||
struct DjuiText* text = djui_text_create(&body->base, "Are you sure you want to quit?");
|
||||
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
@ -45,17 +22,25 @@ void djui_panel_quit_create(struct DjuiBase* caller) {
|
|||
djui_base_set_color(&text->base, 200, 200, 200, 255);
|
||||
djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
|
||||
struct DjuiButton* button1 = djui_button_create(&body->base, "Yes");
|
||||
struct DjuiRect* rect1 = djui_rect_create(&body->base);
|
||||
djui_base_set_size_type(&rect1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&rect1->base, 1.0f, 64);
|
||||
djui_base_set_color(&rect1->base, 0, 0, 0, 0);
|
||||
{
|
||||
struct DjuiButton* button1 = djui_button_create(&rect1->base, "No");
|
||||
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button1->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button1->base, djui_panel_quit_yes);
|
||||
djui_base_set_size(&button1->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button1->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button1->base, djui_panel_quit_no);
|
||||
defaultBase = &button1->base;
|
||||
|
||||
buttonNo = djui_button_create(&body->base, "No");
|
||||
djui_base_set_size_type(&buttonNo->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&buttonNo->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&buttonNo->base, djui_panel_quit_no);
|
||||
struct DjuiButton* button2 = djui_button_create(&rect1->base, "Yes");
|
||||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button2->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_quit_yes);
|
||||
}
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, &buttonNo->base);
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
||||
|
|
|
@ -2,42 +2,18 @@
|
|||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
static void djui_panel_sound_back(struct DjuiBase* base) {
|
||||
djui_panel_back();
|
||||
}
|
||||
|
||||
void djui_panel_sound_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 32 * 4 + 64 * 1 + 16 * 4;
|
||||
|
||||
struct DjuiSlider* slider1 = NULL;
|
||||
struct DjuiBase* defaultBase = NULL;
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\S\\#1be700\\O\\#00b3ff\\U\\#ffef00\\N\\#ff0800\\D");
|
||||
struct DjuiFlowLayout* body = (struct DjuiFlowLayout*)djui_three_panel_get_body(panel);
|
||||
|
||||
struct DjuiThreePanel* panel = djui_three_panel_create(&gDjuiRoot->base, 64, bodyHeight, 0);
|
||||
djui_base_set_size_type(&panel->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_RELATIVE);
|
||||
djui_base_set_size(&panel->base, 340.0f + (16 * 2.0f), 1.0f);
|
||||
djui_base_set_color(&panel->base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(&panel->base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(&panel->base, 8);
|
||||
djui_base_set_padding(&panel->base, 16, 16, 16, 16);
|
||||
{
|
||||
struct DjuiText* header = djui_text_create(&panel->base, "\\#ff0800\\S\\#1be700\\O\\#00b3ff\\U\\#ffef00\\N\\#ff0800\\D");
|
||||
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_color(&header->base, 255, 8, 0, 255);
|
||||
djui_text_set_alignment(header, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_text_set_font(header, &gDjuiFonts[1]);
|
||||
djui_text_set_font_scale(header, gDjuiFonts[1].defaultFontScale);
|
||||
|
||||
struct DjuiFlowLayout* body = djui_flow_layout_create(&panel->base);
|
||||
djui_base_set_alignment(&body->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
djui_base_set_size_type(&body->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&body->base, 1.0f, bodyHeight);
|
||||
djui_base_set_color(&body->base, 0, 0, 0, 0);
|
||||
djui_flow_layout_set_margin(body, 16);
|
||||
djui_flow_layout_set_flow_direction(body, DJUI_FLOW_DIR_DOWN);
|
||||
{
|
||||
slider1 = djui_slider_create(&body->base, "Master Volume", &configMasterVolume, 0, 127);
|
||||
struct DjuiSlider* slider1 = djui_slider_create(&body->base, "Master Volume", &configMasterVolume, 0, 127);
|
||||
djui_base_set_size_type(&slider1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&slider1->base, 1.0f, 32);
|
||||
defaultBase = &slider1->base;
|
||||
|
||||
struct DjuiSlider* slider2 = djui_slider_create(&body->base, "Music Volume", &configMusicVolume, 0, 127);
|
||||
djui_base_set_size_type(&slider2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
|
@ -54,9 +30,8 @@ void djui_panel_sound_create(struct DjuiBase* caller) {
|
|||
struct DjuiButton* button6 = djui_button_create(&body->base, "Back");
|
||||
djui_base_set_size_type(&button6->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button6->base, 1.0f, 64);
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_sound_back);
|
||||
}
|
||||
djui_interactable_hook_click(&button6->base, djui_panel_menu_back);
|
||||
}
|
||||
|
||||
djui_panel_add(caller, &panel->base, &slider1->base);
|
||||
djui_panel_add(caller, &panel->base, defaultBase);
|
||||
}
|
||||
|
|
|
@ -300,9 +300,9 @@ static void djui_text_render(struct DjuiBase* base) {
|
|||
// count lines
|
||||
u16 startIndex = 0;
|
||||
u16 endIndex = 0;
|
||||
f32 maxLineWidth = comp->width / text->fontScale;
|
||||
f32 maxLineWidth = comp->width / ((f32)text->fontScale);
|
||||
u16 lineCount = 0;
|
||||
u16 maxLines = comp->height / ((f32)text->font->charHeight * text->fontScale);
|
||||
u16 maxLines = comp->height / ((f32)text->font->lineHeight * text->fontScale);
|
||||
while (text->message[startIndex] != '\0') {
|
||||
bool onLastLine = lineCount + 1 >= maxLines;
|
||||
f32 lineWidth;
|
||||
|
|
|
@ -1,5 +1,37 @@
|
|||
#include "djui.h"
|
||||
|
||||
struct DjuiBase* djui_three_panel_get_header(struct DjuiThreePanel* threePanel) {
|
||||
struct DjuiBase* children[3] = { NULL };
|
||||
struct DjuiBaseChild* child = threePanel->base.child;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (child == NULL || child->base == NULL) { break; }
|
||||
children[i] = child->base;
|
||||
child = child->next;
|
||||
}
|
||||
return children[0];
|
||||
}
|
||||
|
||||
struct DjuiBase* djui_three_panel_get_body(struct DjuiThreePanel* threePanel) {
|
||||
struct DjuiBase* children[3] = { NULL };
|
||||
struct DjuiBaseChild* child = threePanel->base.child;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (child == NULL || child->base == NULL) { break; }
|
||||
children[i] = child->base;
|
||||
child = child->next;
|
||||
}
|
||||
return children[1];
|
||||
}
|
||||
|
||||
struct DjuiBase* djui_three_panel_get_footer(struct DjuiThreePanel* threePanel) {
|
||||
struct DjuiBase* children[3] = { NULL };
|
||||
struct DjuiBaseChild* child = threePanel->base.child;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (child == NULL || child->base == NULL) { break; }
|
||||
children[i] = child->base;
|
||||
child = child->next;
|
||||
}
|
||||
return children[2];
|
||||
}
|
||||
|
||||
void djui_three_panel_set_min_header_size_type(struct DjuiThreePanel* threePanel, enum DjuiScreenValueType minHeaderSizeType) {
|
||||
threePanel->minHeaderSize.type = minHeaderSizeType;
|
||||
|
@ -77,8 +109,8 @@ void djui_three_panel_render(struct DjuiBase* base) {
|
|||
}
|
||||
|
||||
if (head != NULL) {
|
||||
djui_base_set_location_type(head, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_location(head, 0, 0);
|
||||
//djui_base_set_location_type(head, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE);
|
||||
//djui_base_set_location(head, 0, 0);
|
||||
djui_base_set_size_type(head, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(head, 1.0f, headerSize);
|
||||
djui_base_set_alignment(head, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
|
|
|
@ -9,6 +9,10 @@ struct DjuiThreePanel {
|
|||
struct DjuiScreenValue minFooterSize;
|
||||
};
|
||||
|
||||
struct DjuiBase* djui_three_panel_get_header(struct DjuiThreePanel* threePanel);
|
||||
struct DjuiBase* djui_three_panel_get_body(struct DjuiThreePanel* threePanel);
|
||||
struct DjuiBase* djui_three_panel_get_footer(struct DjuiThreePanel* threePanel);
|
||||
|
||||
void djui_three_panel_set_min_header_size_type(struct DjuiThreePanel* threePanel, enum DjuiScreenValueType minHeaderSizeType);
|
||||
void djui_three_panel_set_min_header_size(struct DjuiThreePanel* threePanel, f32 minHeaderSize);
|
||||
void djui_three_panel_set_body_size_type(struct DjuiThreePanel* threePanel, enum DjuiScreenValueType bodySizeType);
|
||||
|
|
Loading…
Reference in a new issue