diff --git a/build-windows-visual-studio/sm64ex.vcxproj b/build-windows-visual-studio/sm64ex.vcxproj
index da065894..71f2bf18 100644
--- a/build-windows-visual-studio/sm64ex.vcxproj
+++ b/build-windows-visual-studio/sm64ex.vcxproj
@@ -3943,8 +3943,10 @@
+
+
@@ -4379,8 +4381,10 @@
+
+
diff --git a/build-windows-visual-studio/sm64ex.vcxproj.filters b/build-windows-visual-studio/sm64ex.vcxproj.filters
index 195deb5e..3e25342b 100644
--- a/build-windows-visual-studio/sm64ex.vcxproj.filters
+++ b/build-windows-visual-studio/sm64ex.vcxproj.filters
@@ -15234,6 +15234,12 @@
Source Files\src\pc\djui\component\compound
+
+ Source Files\src\pc\djui\panel
+
+
+ Source Files\src\pc\djui\component\compound
+
@@ -16288,5 +16294,11 @@
Source Files\src\pc\djui\component\compound
+
+ Source Files\src\pc\djui\panel
+
+
+ Source Files\src\pc\djui\component\compound
+
\ No newline at end of file
diff --git a/misc/n64-controller.svg b/misc/n64-controller.svg
new file mode 100644
index 00000000..7fd210c5
--- /dev/null
+++ b/misc/n64-controller.svg
@@ -0,0 +1,203 @@
+
+
diff --git a/src/pc/djui/djui.h b/src/pc/djui/djui.h
index e5bcceb5..bab36d38 100644
--- a/src/pc/djui/djui.h
+++ b/src/pc/djui/djui.h
@@ -25,12 +25,14 @@
#include "djui_slider.h"
#include "djui_checkbox.h"
#include "djui_selectionbox.h"
+#include "djui_bind.h"
#include "djui_panel.h"
#include "djui_panel_debug.h"
#include "djui_panel_main.h"
#include "djui_panel_options.h"
#include "djui_panel_camera.h"
+#include "djui_panel_controls.h"
#include "djui_panel_display.h"
#include "djui_panel_sound.h"
#include "djui_panel_quit.h"
diff --git a/src/pc/djui/djui_base.h b/src/pc/djui/djui_base.h
index 9aff2db7..faca43dc 100644
--- a/src/pc/djui/djui_base.h
+++ b/src/pc/djui/djui_base.h
@@ -43,6 +43,7 @@ struct DjuiBase {
struct DjuiBaseRect comp;
struct DjuiBaseRect clip;
struct DjuiInteractable* interactable;
+ s32 tag;
void (*on_child_render)(struct DjuiBase*, struct DjuiBase*);
void (*on_render_pre)(struct DjuiBase*, bool*);
void (*render)(struct DjuiBase*);
diff --git a/src/pc/djui/djui_bind.c b/src/pc/djui/djui_bind.c
new file mode 100644
index 00000000..9239b276
--- /dev/null
+++ b/src/pc/djui/djui_bind.c
@@ -0,0 +1,98 @@
+#include
+#include
+#include "djui.h"
+#include "src/pc/controller/controller_api.h"
+#include "audio_defines.h"
+#include "audio/external.h"
+
+#define VK_ESCAPE 1
+
+static void djui_bind_button_on_click(struct DjuiBase* caller) {
+ struct DjuiButton* button = (struct DjuiButton*)caller;
+ djui_text_set_text(button->text, "...");
+ controller_get_raw_key(); // consume lingering controller button press
+ djui_interactable_set_binding(caller);
+}
+
+static void djui_bind_button_on_bind(struct DjuiBase* caller) {
+ struct DjuiButton* button = (struct DjuiButton*)caller;
+ struct DjuiBind* bind = (struct DjuiBind*) caller->parent->parent;
+
+ // get key
+ u32 key = controller_get_raw_key();
+ if (key == VK_INVALID) { return; }
+
+ // invalidate key
+ if (key == VK_ESCAPE) { key = VK_INVALID; }
+ for (int i = 0; i < MAX_BINDS; i++) {
+ if (i == button->base.tag) { continue; }
+ if (bind->configKey[i] == key) {
+ key = VK_INVALID;
+ }
+ }
+
+ // set key
+ bind->configKey[button->base.tag] = key;
+ char keyStr[5] = { 0 };
+ if (key != VK_INVALID) {
+ sprintf(keyStr, "%04x", key);
+ }
+ djui_text_set_text(button->text, keyStr);
+ djui_interactable_set_binding(NULL);
+ play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs);
+}
+
+static void djui_bind_destroy(struct DjuiBase* base) {
+ struct DjuiBind* bind = (struct DjuiBind*)base;
+ free(bind);
+}
+
+struct DjuiBind* djui_bind_create(struct DjuiBase* parent, const char* message, unsigned int configKey[]) {
+ struct DjuiBind* bind = malloc(sizeof(struct DjuiBind));
+ struct DjuiBase* base = &bind->base;
+
+ bind->configKey = configKey;
+
+ djui_base_init(parent, base, NULL, djui_bind_destroy);
+ djui_base_set_size_type(&bind->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
+ djui_base_set_size(&bind->base, 1.0f, 32);
+ djui_base_set_color(&bind->base, 0, 0, 0, 0);
+
+ struct DjuiText* text = djui_text_create(&bind->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.3f, 1.0f);
+ djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_BOTTOM);
+ djui_text_set_drop_shadow(text, 120, 120, 120, 64);
+ djui_base_set_color(&text->base, 200, 200, 200, 255);
+ bind->text = text;
+
+ struct DjuiRect* rect = djui_rect_create(&bind->base);
+ djui_base_set_alignment(&rect->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_CENTER);
+ djui_base_set_size_type(&rect->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
+ djui_base_set_size(&rect->base, 0.7f, 1.0f);
+ djui_base_set_color(&rect->base, 0, 0, 0, 0);
+ bind->rect = rect;
+
+ for (int i = 0; i < MAX_BINDS; i++) {
+ unsigned int key = configKey[i];
+ char keyStr[5] = { 0 };
+ if (key != VK_INVALID) {
+ sprintf(keyStr, "%04x", key);
+ }
+ struct DjuiButton* button = djui_button_create(&rect->base, keyStr);
+ djui_base_set_size_type(&button->base, DJUI_SVT_RELATIVE, DJUI_SVT_RELATIVE);
+ djui_base_set_size(&button->base, 0.33f, 1.0f);
+ button->base.tag = i;
+ djui_interactable_hook_click(&button->base, djui_bind_button_on_click);
+ djui_interactable_hook_bind(&button->base, djui_bind_button_on_bind);
+
+ enum DjuiHAlign hAlign = DJUI_HALIGN_LEFT;
+ if (i > 0) { hAlign = (i == 1) ? DJUI_HALIGN_CENTER : DJUI_HALIGN_RIGHT; }
+ djui_base_set_alignment(&button->base, hAlign, DJUI_VALIGN_CENTER);
+
+ bind->buttons[i] = button;
+ }
+
+ return bind;
+}
diff --git a/src/pc/djui/djui_bind.h b/src/pc/djui/djui_bind.h
new file mode 100644
index 00000000..cc09062c
--- /dev/null
+++ b/src/pc/djui/djui_bind.h
@@ -0,0 +1,14 @@
+#pragma once
+#include "djui.h"
+#include "src/pc/configfile.h"
+
+#pragma pack(1)
+struct DjuiBind {
+ struct DjuiBase base;
+ struct DjuiText* text;
+ struct DjuiRect* rect;
+ struct DjuiButton* buttons[MAX_BINDS];
+ unsigned int* configKey;
+};
+
+struct DjuiBind* djui_bind_create(struct DjuiBase* parent, const char* message, unsigned int configKey[]);
diff --git a/src/pc/djui/djui_cursor.c b/src/pc/djui/djui_cursor.c
index fa5baddb..db0deb35 100644
--- a/src/pc/djui/djui_cursor.c
+++ b/src/pc/djui/djui_cursor.c
@@ -104,6 +104,8 @@ void djui_cursor_move(s8 xDir, s8 yDir) {
void djui_cursor_update(void) {
#if defined(CAPI_SDL2) || defined(CAPI_SDL1)
+ if (djui_interactable_is_binding()) { return; }
+
controller_sdl_read_mouse_window();
// check if mouse is in control again
diff --git a/src/pc/djui/djui_flow_layout.c b/src/pc/djui/djui_flow_layout.c
index f99d4cdb..3fd7d7f7 100644
--- a/src/pc/djui/djui_flow_layout.c
+++ b/src/pc/djui/djui_flow_layout.c
@@ -1,5 +1,4 @@
#include "djui.h"
-#include
////////////////
// properties //
diff --git a/src/pc/djui/djui_interactable.c b/src/pc/djui/djui_interactable.c
index ff48e22d..2269d591 100644
--- a/src/pc/djui/djui_interactable.c
+++ b/src/pc/djui/djui_interactable.c
@@ -6,6 +6,9 @@
#include "src/pc/controller/controller_mouse.h"
#include "src/pc/controller/controller_keyboard.h"
+#include "audio_defines.h"
+#include "audio/external.h"
+
#define SCANCODE_UP 328
#define SCANCODE_DOWN 336
#define SCANCODE_LEFT 331
@@ -19,7 +22,10 @@ enum PadHoldDirection { PAD_HOLD_DIR_NONE, PAD_HOLD_DIR_UP, PAD_HOLD_DIR_DOWN, P
static enum PadHoldDirection sKeyboardHoldDirection = PAD_HOLD_DIR_NONE;
static u16 sKeyboardButtons = 0;
-static struct DjuiBase* sInteractableFocus = NULL;
+static bool sIgnoreInteractableUntilCursorReleased = false;
+
+static struct DjuiBase* sInteractableFocus = NULL;
+static struct DjuiBase* sInteractableBinding = NULL;
static struct DjuiBase* sHovered = NULL;
static struct DjuiBase* sMouseDown = NULL;
bool gInteractableOverridePad = false;
@@ -107,6 +113,13 @@ static void djui_interactable_on_value_change(struct DjuiBase* base) {
base->interactable->on_value_change(base);
}
+static void djui_interactable_on_bind(struct DjuiBase* base) {
+ if (base == NULL) { return; }
+ if (base->interactable == NULL) { return; }
+ if (base->interactable->on_bind == NULL) { return; }
+ base->interactable->on_bind(base);
+}
+
static void djui_interactable_cursor_update_active(struct DjuiBase* base) {
if (!base->visible) { return; }
if (!base->enabled) { return; }
@@ -134,6 +147,18 @@ static void djui_interactable_cursor_update_active(struct DjuiBase* base) {
}
}
+bool djui_interactable_is_binding(void) {
+ return sInteractableBinding != NULL;
+}
+
+void djui_interactable_set_binding(struct DjuiBase* base) {
+ sInteractableBinding = base;
+ djui_cursor_set_visible(base == NULL);
+ if (base == NULL) {
+ sIgnoreInteractableUntilCursorReleased = true;
+ }
+}
+
void djui_interactable_set_input_focus(struct DjuiBase* base) {
djui_interactable_on_focus_end(base);
sInteractableFocus = base;
@@ -215,20 +240,34 @@ void djui_interactable_update(void) {
// update pad
djui_interactable_update_pad();
- if (sInteractableFocus != NULL) {
+ // prevent pressing buttons when they should be ignored
+ int mouseButtons = mouse_window_buttons;
+ u16 padButtons = gInteractablePad.button;
+ if (sIgnoreInteractableUntilCursorReleased) {
+ if ((padButtons & PAD_BUTTON_A) || (mouseButtons & MOUSE_BUTTON_1)) {
+ padButtons &= ~PAD_BUTTON_A;
+ mouseButtons &= ~MOUSE_BUTTON_1;
+ } else {
+ sIgnoreInteractableUntilCursorReleased = false;
+ }
+ }
+
+ if (sInteractableBinding != NULL) {
+ djui_interactable_on_bind(sInteractableBinding);
+ } else if (sInteractableFocus != NULL) {
// escape focus
u16 buttons = PAD_BUTTON_A | PAD_BUTTON_B;
- if ((gInteractablePad.button & buttons) && !(sLastInteractablePad.button & buttons)) {
+ if ((padButtons & buttons) && !(sLastInteractablePad.button & buttons)) {
djui_interactable_set_input_focus(NULL);
} else {
djui_interactable_on_focus(sInteractableFocus);
}
- } else if ((gInteractablePad.button & PAD_BUTTON_A) || (mouse_window_buttons & MOUSE_BUTTON_1)) {
+ } else if ((padButtons & PAD_BUTTON_A) || (mouseButtons & MOUSE_BUTTON_1)) {
// cursor down events
if (sHovered != NULL) {
sMouseDown = sHovered;
sHovered = NULL;
- djui_interactable_on_cursor_down_begin(sMouseDown, !mouse_window_buttons);
+ djui_interactable_on_cursor_down_begin(sMouseDown, !mouseButtons);
} else {
djui_interactable_on_cursor_down(sMouseDown);
}
@@ -243,6 +282,7 @@ void djui_interactable_update(void) {
djui_interactable_cursor_update_active(&gDjuiRoot->base);
if (lastHovered != sHovered) {
djui_interactable_on_hover_end(lastHovered);
+ play_sound(SOUND_MENU_MESSAGE_NEXT_PAGE, gDefaultSoundArgs);
}
djui_interactable_on_hover(sHovered);
}
@@ -290,6 +330,12 @@ void djui_interactable_hook_value_change(struct DjuiBase* base,
interactable->on_value_change = on_value_change;
}
+void djui_interactable_hook_bind(struct DjuiBase* base,
+ void (*on_bind)(struct DjuiBase*)) {
+ struct DjuiInteractable* interactable = base->interactable;
+ interactable->on_bind = on_bind;
+}
+
void djui_interactable_create(struct DjuiBase* base) {
if (base->interactable != NULL) {
diff --git a/src/pc/djui/djui_interactable.h b/src/pc/djui/djui_interactable.h
index 734dc0bf..3b4a89c3 100644
--- a/src/pc/djui/djui_interactable.h
+++ b/src/pc/djui/djui_interactable.h
@@ -20,17 +20,19 @@ struct DjuiInteractable {
void (*on_focus_end)(struct DjuiBase*);
void (*on_click)(struct DjuiBase*);
void (*on_value_change)(struct DjuiBase*);
+ void (*on_bind)(struct DjuiBase*);
};
extern bool gInteractableOverridePad;
extern OSContPad gInteractablePad;
+bool djui_interactable_is_binding(void);
+void djui_interactable_set_binding(struct DjuiBase* base);
void djui_interactable_set_input_focus(struct DjuiBase* base);
void djui_interactable_on_key_down(int scancode);
void djui_interactable_on_key_up(int scancode);
void djui_interactable_update(void);
-
void djui_interactable_hook_hover(struct DjuiBase* base,
void (*on_hover)(struct DjuiBase*),
void (*on_hover_end)(struct DjuiBase*));
@@ -51,4 +53,6 @@ void djui_interactable_hook_click(struct DjuiBase* base,
void djui_interactable_hook_value_change(struct DjuiBase* base,
void (*on_value_change)(struct DjuiBase*));
+void djui_interactable_hook_bind(struct DjuiBase* base,
+ void (*on_bind)(struct DjuiBase*));
void djui_interactable_create(struct DjuiBase* base);
diff --git a/src/pc/djui/djui_panel.c b/src/pc/djui/djui_panel.c
index bfcbe78a..b31f1779 100644
--- a/src/pc/djui/djui_panel.c
+++ b/src/pc/djui/djui_panel.c
@@ -1,5 +1,7 @@
#include "djui.h"
#include "src/pc/utils/misc.h"
+#include "audio_defines.h"
+#include "audio/external.h"
struct DjuiPanel {
struct DjuiBase* base;
@@ -45,6 +47,8 @@ void djui_panel_add(struct DjuiBase* caller, struct DjuiBase* panelBase, struct
djui_base_set_location(panelBase, 0, 0);
djui_cursor_input_controlled_center(panel->defaultElementBase);
djui_base_set_enabled(panel->base, true);
+ } else {
+ play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs);
}
}
@@ -69,6 +73,9 @@ void djui_panel_back(void) {
// set new active as visible
djui_base_set_visible(sPanelList->base, true);
+
+ // play a sound
+ play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs);
}
void djui_panel_update(void) {
diff --git a/src/pc/djui/djui_panel_camera.c b/src/pc/djui/djui_panel_camera.c
index df330783..6be7aa9d 100644
--- a/src/pc/djui/djui_panel_camera.c
+++ b/src/pc/djui/djui_panel_camera.c
@@ -78,7 +78,7 @@ 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);
- button6->base.interactable->on_click = djui_panel_camera_back;
+ djui_interactable_hook_click(&button6->base, djui_panel_camera_back);
}
}
diff --git a/src/pc/djui/djui_panel_controls.c b/src/pc/djui/djui_panel_controls.c
new file mode 100644
index 00000000..dc09550b
--- /dev/null
+++ b/src/pc/djui/djui_panel_controls.c
@@ -0,0 +1,73 @@
+#include "djui.h"
+#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 DjuiFlowLayout* bindBody = djui_flow_layout_create(&body->base);
+ 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_color(&bindBody->base, 0, 0, 0, 0);
+ djui_flow_layout_set_margin(bindBody, 1);
+ {
+ 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);
+ struct DjuiBind* bind5 = djui_bind_create(&bindBody->base, "R", configKeyR);
+ struct DjuiBind* bind6 = djui_bind_create(&bindBody->base, "Z", configKeyZ);
+ struct DjuiBind* bind7 = djui_bind_create(&bindBody->base, "C Up", configKeyCUp);
+ struct DjuiBind* bind8 = djui_bind_create(&bindBody->base, "C Down", configKeyCDown);
+ 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);
+ }
+
+ struct DjuiSlider* slider1 = djui_slider_create(&body->base, "Deadzone", &configStickDeadzone, 0, 100);
+ djui_base_set_size_type(&slider1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
+ djui_base_set_size(&slider1->base, 1.0f, 32);
+
+ struct DjuiSlider* slider2 = djui_slider_create(&body->base, "Rumble Strength", &configRumbleStrength, 0, 100);
+ djui_base_set_size_type(&slider2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
+ djui_base_set_size(&slider2->base, 1.0f, 32);
+
+ 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_panel_add(caller, &panel->base, &bind1->base);
+}
diff --git a/src/pc/djui/djui_panel_controls.h b/src/pc/djui/djui_panel_controls.h
new file mode 100644
index 00000000..93408bd5
--- /dev/null
+++ b/src/pc/djui/djui_panel_controls.h
@@ -0,0 +1,4 @@
+#pragma once
+#include "djui.h"
+
+void djui_panel_controls_create(struct DjuiBase* caller);
diff --git a/src/pc/djui/djui_panel_display.c b/src/pc/djui/djui_panel_display.c
index af4ca7bd..db089936 100644
--- a/src/pc/djui/djui_panel_display.c
+++ b/src/pc/djui/djui_panel_display.c
@@ -61,7 +61,7 @@ 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);
- button6->base.interactable->on_click = djui_panel_display_back;
+ djui_interactable_hook_click(&button6->base, djui_panel_display_back);
}
}
diff --git a/src/pc/djui/djui_panel_main.c b/src/pc/djui/djui_panel_main.c
index 8c46ca1e..02e76a61 100644
--- a/src/pc/djui/djui_panel_main.c
+++ b/src/pc/djui/djui_panel_main.c
@@ -37,7 +37,7 @@ void djui_panel_main_create(struct DjuiBase* caller) {
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);
- buttonHost->base.interactable->on_click = djui_panel_main_close;
+ djui_interactable_hook_click(&buttonHost->base, djui_panel_main_close);
struct DjuiButton* button2 = djui_button_create(&body->base, "Join");
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
@@ -46,12 +46,12 @@ void djui_panel_main_create(struct DjuiBase* caller) {
struct DjuiButton* button3 = djui_button_create(&body->base, "Options");
djui_base_set_size_type(&button3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button3->base, 1.0f, 64);
- button3->base.interactable->on_click = djui_panel_options_create;
+ djui_interactable_hook_click(&button3->base, djui_panel_options_create);
struct DjuiButton* button4 = djui_button_create(&body->base, "Quit");
djui_base_set_size_type(&button4->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button4->base, 1.0f, 64);
- button4->base.interactable->on_click = djui_panel_quit_create;
+ djui_interactable_hook_click(&button4->base, djui_panel_quit_create);
}
char* version = get_version();
diff --git a/src/pc/djui/djui_panel_options.c b/src/pc/djui/djui_panel_options.c
index e269a943..f87d91e5 100644
--- a/src/pc/djui/djui_panel_options.c
+++ b/src/pc/djui/djui_panel_options.c
@@ -41,26 +41,27 @@ void djui_panel_options_create(struct DjuiBase* caller) {
struct DjuiButton* button2 = djui_button_create(&body->base, "Camera");
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button2->base, 1.0f, 64);
- button2->base.interactable->on_click = djui_panel_camera_create;
+ djui_interactable_hook_click(&button2->base, djui_panel_camera_create);
struct DjuiButton* button3 = djui_button_create(&body->base, "Controls");
djui_base_set_size_type(&button3->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button3->base, 1.0f, 64);
+ djui_interactable_hook_click(&button3->base, djui_panel_controls_create);
struct DjuiButton* button4 = djui_button_create(&body->base, "Display");
djui_base_set_size_type(&button4->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button4->base, 1.0f, 64);
- button4->base.interactable->on_click = djui_panel_display_create;
+ djui_interactable_hook_click(&button4->base, djui_panel_display_create);
struct DjuiButton* button5 = djui_button_create(&body->base, "Sound");
djui_base_set_size_type(&button5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button5->base, 1.0f, 64);
- button5->base.interactable->on_click = djui_panel_sound_create;
+ djui_interactable_hook_click(&button5->base, djui_panel_sound_create);
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);
- button6->base.interactable->on_click = djui_panel_options_back;
+ djui_interactable_hook_click(&button6->base, djui_panel_options_back);
}
}
diff --git a/src/pc/djui/djui_panel_quit.c b/src/pc/djui/djui_panel_quit.c
index 4394da34..e5da6086 100644
--- a/src/pc/djui/djui_panel_quit.c
+++ b/src/pc/djui/djui_panel_quit.c
@@ -48,12 +48,12 @@ void djui_panel_quit_create(struct DjuiBase* caller) {
struct DjuiButton* button1 = djui_button_create(&body->base, "Yes");
djui_base_set_size_type(&button1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&button1->base, 1.0f, 64);
- button1->base.interactable->on_click = djui_panel_quit_yes;
+ djui_interactable_hook_click(&button1->base, djui_panel_quit_yes);
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);
- buttonNo->base.interactable->on_click = djui_panel_quit_no;
+ djui_interactable_hook_click(&buttonNo->base, djui_panel_quit_no);
}
}
diff --git a/src/pc/djui/djui_panel_sound.c b/src/pc/djui/djui_panel_sound.c
index 36bc7969..6d47e129 100644
--- a/src/pc/djui/djui_panel_sound.c
+++ b/src/pc/djui/djui_panel_sound.c
@@ -54,7 +54,7 @@ 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);
- button6->base.interactable->on_click = djui_panel_sound_back;
+ djui_interactable_hook_click(&button6->base, djui_panel_sound_back);
}
}