Disable freecam options if freecam is off
This commit is contained in:
parent
3d2436c808
commit
8209554f69
|
@ -5,8 +5,32 @@
|
|||
#include "pc/configfile.h"
|
||||
#include "game/bettercamera.h"
|
||||
|
||||
void djui_panel_camera_value_changed(UNUSED struct DjuiBase* caller) {
|
||||
#define FREE_CAMERA_OPTIONS 9
|
||||
|
||||
static struct DjuiBase* sFreeCameraOptions[FREE_CAMERA_OPTIONS] = { 0 };
|
||||
static u8 sIndex = 0;
|
||||
|
||||
static struct DjuiCheckbox* djui_linked_checkbox_create(struct DjuiBase* parent, const char* message, bool* value, void (*on_value_change)(struct DjuiBase*)) {
|
||||
struct DjuiCheckbox* checkbox = djui_checkbox_create(parent, message, value, on_value_change);
|
||||
djui_base_set_enabled(&checkbox->base, configEnableCamera);
|
||||
sFreeCameraOptions[sIndex] = &checkbox->base;
|
||||
sIndex++;
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
static struct DjuiSlider* djui_linked_slider_create(struct DjuiBase* parent, const char* message, unsigned int* value, unsigned int min, unsigned int max, void (*on_value_change)(struct DjuiBase*)) {
|
||||
struct DjuiSlider* slider = djui_slider_create(parent, message, value, min, max, on_value_change);
|
||||
djui_base_set_enabled(&slider->base, configEnableCamera);
|
||||
sFreeCameraOptions[sIndex] = &slider->base;
|
||||
sIndex++;
|
||||
return slider;
|
||||
}
|
||||
|
||||
static void djui_panel_camera_value_changed(UNUSED struct DjuiBase* caller) {
|
||||
newcam_init_settings();
|
||||
for (s32 i = 0; i < FREE_CAMERA_OPTIONS; i++) {
|
||||
djui_base_set_enabled(sFreeCameraOptions[i], configEnableCamera);
|
||||
}
|
||||
}
|
||||
|
||||
void djui_panel_camera_create(struct DjuiBase* caller) {
|
||||
|
@ -14,15 +38,16 @@ void djui_panel_camera_create(struct DjuiBase* caller) {
|
|||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||
{
|
||||
djui_checkbox_create(body, DLANG(CAMERA, FREE_CAMERA), &configEnableCamera, djui_panel_camera_value_changed);
|
||||
djui_checkbox_create(body, DLANG(CAMERA, ANALOG_CAMERA), &configCameraAnalog, djui_panel_camera_value_changed);
|
||||
djui_checkbox_create(body, DLANG(CAMERA, MOUSE_LOOK), &configCameraMouse, djui_panel_camera_value_changed);
|
||||
djui_checkbox_create(body, DLANG(CAMERA, INVERT_X), &configCameraInvertX, djui_panel_camera_value_changed);
|
||||
djui_checkbox_create(body, DLANG(CAMERA, INVERT_Y), &configCameraInvertY, djui_panel_camera_value_changed);
|
||||
djui_slider_create(body, DLANG(CAMERA, X_SENSITIVITY), &configCameraXSens, 1, 100, djui_panel_camera_value_changed);
|
||||
djui_slider_create(body, DLANG(CAMERA, Y_SENSITIVITY), &configCameraYSens, 1, 100, djui_panel_camera_value_changed);
|
||||
djui_slider_create(body, DLANG(CAMERA, AGGRESSION), &configCameraAggr, 0, 100, djui_panel_camera_value_changed);
|
||||
djui_slider_create(body, DLANG(CAMERA, PAN_LEVEL), &configCameraPan, 0, 100, djui_panel_camera_value_changed);
|
||||
djui_slider_create(body, DLANG(CAMERA, DECELERATION), &configCameraDegrade, 0, 100, djui_panel_camera_value_changed);
|
||||
djui_linked_checkbox_create(body, DLANG(CAMERA, ANALOG_CAMERA), &configCameraAnalog, djui_panel_camera_value_changed);
|
||||
djui_linked_checkbox_create(body, DLANG(CAMERA, MOUSE_LOOK), &configCameraMouse, djui_panel_camera_value_changed);
|
||||
djui_linked_checkbox_create(body, DLANG(CAMERA, INVERT_X), &configCameraInvertX, djui_panel_camera_value_changed);
|
||||
djui_linked_checkbox_create(body, DLANG(CAMERA, INVERT_Y), &configCameraInvertY, djui_panel_camera_value_changed);
|
||||
djui_linked_slider_create(body, DLANG(CAMERA, X_SENSITIVITY), &configCameraXSens, 1, 100, djui_panel_camera_value_changed);
|
||||
djui_linked_slider_create(body, DLANG(CAMERA, Y_SENSITIVITY), &configCameraYSens, 1, 100, djui_panel_camera_value_changed);
|
||||
djui_linked_slider_create(body, DLANG(CAMERA, AGGRESSION), &configCameraAggr, 0, 100, djui_panel_camera_value_changed);
|
||||
djui_linked_slider_create(body, DLANG(CAMERA, PAN_LEVEL), &configCameraPan, 0, 100, djui_panel_camera_value_changed);
|
||||
djui_linked_slider_create(body, DLANG(CAMERA, DECELERATION), &configCameraDegrade, 0, 100, djui_panel_camera_value_changed);
|
||||
sIndex = 0;
|
||||
|
||||
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define RAINBOW_TEXT_LEN 255
|
||||
|
||||
char* sRainbowColors[] = {
|
||||
"\\#ff5050\\",
|
||||
"\\#ff4040\\",
|
||||
"\\#50e750\\",
|
||||
"\\#50b3ff\\",
|
||||
"\\#ffef50\\",
|
||||
|
|
|
@ -6,6 +6,10 @@ static void djui_slider_update_style(struct DjuiBase* base) {
|
|||
bool activeRegion = (gCursorX >= x);
|
||||
|
||||
if (!slider->base.enabled) {
|
||||
djui_base_set_border_color(&slider->rect->base, 93, 93, 93, 255);
|
||||
djui_base_set_color(&slider->rect->base, 0, 0, 0, 0);
|
||||
djui_base_set_color(&slider->text->base, 100, 100, 100, 255);
|
||||
djui_base_set_color(&slider->rectValue->base, 100, 100, 100, 255);
|
||||
} else if (gInteractableFocus == base) {
|
||||
djui_base_set_border_color(&slider->rect->base, 20, 170, 255, 255);
|
||||
djui_base_set_color(&slider->rect->base, 255, 255, 255, 32);
|
||||
|
|
Loading…
Reference in New Issue