Merge pull request #7 from eros71-dev/main

(WIP) De-hardcode DJUI Scaling, Moved menu-related options
This commit is contained in:
Agent X 2023-11-24 16:18:49 -05:00 committed by GitHub
commit 7610fb2d02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 55 additions and 36 deletions

View file

@ -145,6 +145,7 @@ SHOW_FPS = "Zobrazit FPS"
DJUI_THEMES = "TÉMATA DJUI" DJUI_THEMES = "TÉMATA DJUI"
CENTER = "Střed" CENTER = "Střed"
DJUI_THEME = "Téma DJUI" DJUI_THEME = "Téma DJUI"
DJUI_SCALE = "Stupnice DJUI"
CENTER = "Střed" CENTER = "Střed"
LIGHT_THEME = "Světlo" LIGHT_THEME = "Světlo"
DARK_THEME = "Tmavý" DARK_THEME = "Tmavý"

View file

@ -145,6 +145,7 @@ SHOW_FPS = "Toon FPS"
DJUI_THEMES = "DJUI THEMA'S" DJUI_THEMES = "DJUI THEMA'S"
CENTER = "Centreren" CENTER = "Centreren"
DJUI_THEME = "DJUI Thema" DJUI_THEME = "DJUI Thema"
DJUI_SCALE = "DJUI Schaal"
CENTER = "Centreren" CENTER = "Centreren"
LIGHT_THEME = "Licht" LIGHT_THEME = "Licht"
DARK_THEME = "Donker" DARK_THEME = "Donker"

View file

@ -145,6 +145,7 @@ SHOW_FPS = "Show FPS"
DJUI_THEMES = "DJUI THEMES" DJUI_THEMES = "DJUI THEMES"
CENTER = "Center" CENTER = "Center"
DJUI_THEME = "DJUI Theme" DJUI_THEME = "DJUI Theme"
DJUI_SCALE = "DJUI Scale"
CENTER = "Center" CENTER = "Center"
LIGHT_THEME = "Light" LIGHT_THEME = "Light"
DARK_THEME = "Dark" DARK_THEME = "Dark"

View file

@ -146,6 +146,7 @@ SHOW_FPS = "Afficher FPS"
DJUI_THEMES = "THÈMES DJUI" DJUI_THEMES = "THÈMES DJUI"
CENTER = "Centrer" CENTER = "Centrer"
DJUI_THEME = "Thème DJUI" DJUI_THEME = "Thème DJUI"
DJUI_SCALE = "Échelle DJUI"
CENTER = "Centrer" CENTER = "Centrer"
LIGHT_THEME = "Lumière" LIGHT_THEME = "Lumière"
DARK_THEME = "Sombre" DARK_THEME = "Sombre"

View file

@ -145,6 +145,7 @@ SHOW_FPS = "FPS anzeigen"
DJUI_THEMES = "DJUI-THEMEN" DJUI_THEMES = "DJUI-THEMEN"
CENTER = "Zentrieren" CENTER = "Zentrieren"
DJUI_THEME = "DJUI-Thema" DJUI_THEME = "DJUI-Thema"
DJUI_SCALE = "DJUI-Skala"
CENTER = "Zentrieren" CENTER = "Zentrieren"
LIGHT_THEME = "Litch" LIGHT_THEME = "Litch"
DARK_THEME = "Dunkel" DARK_THEME = "Dunkel"

View file

@ -143,6 +143,7 @@ SHOW_FPS = "Mostra FPS"
DJUI_THEMES = "TEMI DJUI" DJUI_THEMES = "TEMI DJUI"
CENTER = "Centrare" CENTER = "Centrare"
DJUI_THEME = "Tema DJUI" DJUI_THEME = "Tema DJUI"
DJUI_SCALE = "Scala DJUI"
CENTER = "Centrare" CENTER = "Centrare"
LIGHT_THEME = "Luce" LIGHT_THEME = "Luce"
DARK_THEME = "Scuro" DARK_THEME = "Scuro"

View file

@ -145,6 +145,7 @@ SHOW_FPS = "Pokaż FPS"
DJUI_THEMES = "TEMATY DJUI" DJUI_THEMES = "TEMATY DJUI"
CENTER = "Środek" CENTER = "Środek"
DJUI_THEME = "Motyw DJUI" DJUI_THEME = "Motyw DJUI"
DJUI_SCALE = "Skala DJUI"
CENTER = "Środek" CENTER = "Środek"
LIGHT_THEME = "Światło" LIGHT_THEME = "Światło"
DARK_THEME = "Ciemny" DARK_THEME = "Ciemny"

View file

@ -145,6 +145,7 @@ SHOW_FPS = "Mostrar FPS"
DJUI_THEMES = "TEMAS DJUI" DJUI_THEMES = "TEMAS DJUI"
CENTER = "Centralizar" CENTER = "Centralizar"
DJUI_THEME = "Tema DJUI" DJUI_THEME = "Tema DJUI"
DJUI_SCALE = "Tamanho da DJUI"
CENTER = "Centralizar" CENTER = "Centralizar"
LIGHT_THEME = "Claro" LIGHT_THEME = "Claro"
DARK_THEME = "Escuro" DARK_THEME = "Escuro"

View file

@ -144,6 +144,7 @@ SHOW_FPS = "Показывать FPS"
DJUI_THEMES = "ТЕМЫ DJUI" DJUI_THEMES = "ТЕМЫ DJUI"
CENTER = "Центр" CENTER = "Центр"
DJUI_THEME = "Темы DJUI" DJUI_THEME = "Темы DJUI"
DJUI_SCALE = "Шкала DJUI"
CENTER = "Центр" CENTER = "Центр"
LIGHT_THEME = "Свет" LIGHT_THEME = "Свет"
DARK_THEME = "Темный" DARK_THEME = "Темный"

View file

@ -144,6 +144,7 @@ MUST_RESTART = "Tienes que reiniciar el juego para que algunos cambios surtan ef
DJUI_THEMES = "TEMAS de DJUI" DJUI_THEMES = "TEMAS de DJUI"
CENTER = "Centrar" CENTER = "Centrar"
DJUI_THEME = "Tema de DJUI" DJUI_THEME = "Tema de DJUI"
DJUI_SCALE = "Tamaño de DJUI"
CENTER = "Centrar" CENTER = "Centrar"
LIGHT_THEME = "Claro" LIGHT_THEME = "Claro"
DARK_THEME = "Oscuro" DARK_THEME = "Oscuro"

View file

@ -145,6 +145,7 @@ SHOW_FPS = "Mostrar FPS"
DJUI_THEMES = "TEMAS de DJUI" DJUI_THEMES = "TEMAS de DJUI"
CENTER = "Centrar" CENTER = "Centrar"
DJUI_THEME = "Tema de DJUI" DJUI_THEME = "Tema de DJUI"
DJUI_SCALE = "Tamaño de DJUI"
CENTER = "Centrar" CENTER = "Centrar"
LIGHT_THEME = "Claro" LIGHT_THEME = "Claro"
DARK_THEME = "Oscuro" DARK_THEME = "Oscuro"

View file

@ -162,6 +162,7 @@ char configDestId[MAX_CONFIG_STRING] = "0";
bool configFadeoutDistantSounds = false; bool configFadeoutDistantSounds = false;
unsigned int configDjuiTheme = DJUI_THEME_DARK; unsigned int configDjuiTheme = DJUI_THEME_DARK;
bool configDjuiThemeCenter = true; bool configDjuiThemeCenter = true;
unsigned int configDjuiScale = 1;
bool configCoopCompatibility = true; bool configCoopCompatibility = true;
static const struct ConfigOption options[] = { static const struct ConfigOption options[] = {
@ -277,7 +278,8 @@ static const struct ConfigOption options[] = {
{.name = "coopnet_dest", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configDestId, .maxStringLength = MAX_CONFIG_STRING}, {.name = "coopnet_dest", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configDestId, .maxStringLength = MAX_CONFIG_STRING},
{.name = "fade_distant_sounds", .type = CONFIG_TYPE_BOOL , .boolValue = &configFadeoutDistantSounds}, {.name = "fade_distant_sounds", .type = CONFIG_TYPE_BOOL , .boolValue = &configFadeoutDistantSounds},
{.name = "djui_theme", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiTheme}, {.name = "djui_theme", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiTheme},
{.name = "djui_theme_center", .type = CONFIG_TYPE_BOOL , .boolValue = &configDjuiThemeCenter} {.name = "djui_theme_center", .type = CONFIG_TYPE_BOOL , .boolValue = &configDjuiThemeCenter},
{.name = "djui_scale", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiScale}
}; };
// FunctionConfigOption functions // FunctionConfigOption functions

View file

@ -119,6 +119,7 @@ extern char configDestId[];
extern bool configFadeoutDistantSounds; extern bool configFadeoutDistantSounds;
extern unsigned int configDjuiTheme; extern unsigned int configDjuiTheme;
extern bool configDjuiThemeCenter; extern bool configDjuiThemeCenter;
extern unsigned int configDjuiScale;
extern bool configCoopCompatibility; extern bool configCoopCompatibility;
void enable_queued_mods(); void enable_queued_mods();

View file

@ -47,12 +47,12 @@ const Gfx dl_djui_simple_rect[] = {
f32 djui_gfx_get_scale(void) { f32 djui_gfx_get_scale(void) {
u32 windowWidth, windowHeight; u32 windowWidth, windowHeight;
wm_api->get_dimensions(&windowWidth, &windowHeight); wm_api->get_dimensions(&windowWidth, &windowHeight);
if (windowHeight < 768) { switch (configDjuiScale) {
return 0.5f; case 0: return 0.85f;
} else if (windowHeight < 1440) { case 1: return 1.0f;
return 1.0f; case 2: return 1.25f;
} else { case 3: return 1.5f;
return 2.0f; default: return 1.0f;
} }
} }
///////////////////////////////////////////// /////////////////////////////////////////////

View file

@ -1,6 +1,8 @@
#include "djui.h" #include "djui.h"
#include "djui_theme.h"
#include "djui_panel.h" #include "djui_panel.h"
#include "djui_panel_menu.h" #include "djui_panel_menu.h"
#include "djui_panel_pause.h"
#include "src/pc/utils/misc.h" #include "src/pc/utils/misc.h"
#include "src/pc/configfile.h" #include "src/pc/configfile.h"
#include "src/game/level_update.h" #include "src/game/level_update.h"
@ -15,6 +17,25 @@ static void djui_panel_level_menu(UNUSED struct DjuiBase* caller) {
} }
} }
static void djui_panel_misc_djui_setting_change(UNUSED struct DjuiBase* caller) {
// god this is so hacky and terrible - djoslin0, 2023
if (gDjuiInMainMenu) {
djui_panel_shutdown();
gDjuiInMainMenu = true;
djui_panel_main_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
} else if (gDjuiPanelPauseCreated) {
djui_panel_shutdown();
djui_panel_pause_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
} else {
djui_panel_shutdown();
}
}
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(DLANG(MENU_OPTIONS, MAIN_MENU)); struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MENU_OPTIONS, MAIN_MENU));
struct DjuiBase* body = djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
@ -40,6 +61,9 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
"TTC", "TTC",
"WDW" "WDW"
}; };
char* djuiScaleChoices[4] = {"x0.85", "x1.0", "x1.25", "x1.5"};
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL); struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL);
djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll)); djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll));
sLevelBox = selectionbox1; sLevelBox = selectionbox1;
@ -49,6 +73,15 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu); djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo); djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo);
char* themeChoices[DJUI_THEME_MAX];
for (int i = 0; i < DJUI_THEME_MAX; i++) {
themeChoices[i] = (char*)gDjuiThemes[i]->name;
}
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_setting_change);
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_setting_change);
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 4, &configDjuiScale, djui_panel_misc_djui_setting_change);
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
} }

View file

@ -1,11 +1,10 @@
#include "djui.h" #include "djui.h"
#include "djui_theme.h"
#include "djui_panel.h" #include "djui_panel.h"
#include "djui_panel_menu.h" #include "djui_panel_menu.h"
#include "djui_panel_menu_options.h" #include "djui_panel_menu_options.h"
#include "djui_panel_main.h" #include "djui_panel_main.h"
#include "djui_panel_options.h" #include "djui_panel_options.h"
#include "djui_panel_pause.h" //#include "djui_panel_pause.h"
#include "djui_panel_language.h" #include "djui_panel_language.h"
#include "djui_panel_info.h" #include "djui_panel_info.h"
#include "pc/utils/misc.h" #include "pc/utils/misc.h"
@ -25,25 +24,6 @@ static void djui_panel_compatibility_checkbox_on_value_change(UNUSED struct Djui
void djui_panel_misc_create(struct DjuiBase* caller); void djui_panel_misc_create(struct DjuiBase* caller);
static void djui_panel_misc_djui_theme_change(UNUSED struct DjuiBase* caller) {
// god this is so hacky and terrible - djoslin0, 2023
if (gDjuiInMainMenu) {
djui_panel_shutdown();
gDjuiInMainMenu = true;
djui_panel_main_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
} else if (gDjuiPanelPauseCreated) {
djui_panel_shutdown();
djui_panel_pause_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
} else {
djui_panel_shutdown();
}
}
#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(DLANG(MISC, DEBUG_TITLE)); struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MISC, DEBUG_TITLE));
@ -74,14 +54,6 @@ void djui_panel_misc_create(struct DjuiBase* caller) {
djui_checkbox_create(body, DLANG(MISC, PAUSE_IN_SINGLEPLAYER), &configSingleplayerPause, NULL); djui_checkbox_create(body, DLANG(MISC, PAUSE_IN_SINGLEPLAYER), &configSingleplayerPause, NULL);
djui_checkbox_create(body, DLANG(MISC, DISABLE_POPUPS), &configDisablePopups, NULL); djui_checkbox_create(body, DLANG(MISC, DISABLE_POPUPS), &configDisablePopups, NULL);
char* themeChoices[DJUI_THEME_MAX];
for (int i = 0; i < DJUI_THEME_MAX; i++) {
themeChoices[i] = (char*)gDjuiThemes[i]->name;
}
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_theme_change);
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_theme_change);
djui_checkbox_create(body, DLANG(MISC, COOP_COMPATIBILITY), &configCoopCompatibility, djui_panel_compatibility_checkbox_on_value_change); djui_checkbox_create(body, DLANG(MISC, COOP_COMPATIBILITY), &configCoopCompatibility, djui_panel_compatibility_checkbox_on_value_change);
djui_button_create(body, DLANG(MISC, LANGUAGE), DJUI_BUTTON_STYLE_NORMAL, djui_panel_language_create); djui_button_create(body, DLANG(MISC, LANGUAGE), DJUI_BUTTON_STYLE_NORMAL, djui_panel_language_create);