Skip to content

Commit

Permalink
Settings flyout styling
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Jan 19, 2025
1 parent f98cc8e commit fdfe0f3
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,35 @@ void DrawSettingsMenu() {
if (ImGui::BeginMenu("Settings"))
{
if (ImGui::BeginMenu("Audio")) {

UIWidgets::PaddedEnhancementSliderInt("Master Volume: %d %%", "##Master_Vol", CVAR_SETTING("Volume.Master"), 0, 100, "", 100, true, false, true);

UIWidgets::PaddedSeparator();

if (UIWidgets::PaddedEnhancementSliderInt("Main Music Volume: %d %%", "##Main_Music_Vol", CVAR_SETTING("Volume.MainMusic"), 0, 100, "", 100, true, false, true)) {
Audio_SetGameVolume(SEQ_PLAYER_BGM_MAIN, ((float)CVarGetInteger(CVAR_SETTING("Volume.MainMusic"), 100) / 100.0f));
}

UIWidgets::PaddedSeparator();

if (UIWidgets::PaddedEnhancementSliderInt("Sub Music Volume: %d %%", "##Sub_Music_Vol", CVAR_SETTING("Volume.SubMusic"), 0, 100, "", 100, true, false, true)) {
Audio_SetGameVolume(SEQ_PLAYER_BGM_SUB, ((float)CVarGetInteger(CVAR_SETTING("Volume.SubMusic"), 100) / 100.0f));
}

UIWidgets::PaddedSeparator();

if (UIWidgets::PaddedEnhancementSliderInt("Fanfare Volume: %d %%", "##Fanfare_Vol", CVAR_SETTING("Volume.Fanfare"), 0, 100, "", 100, true, false, true)) {
Audio_SetGameVolume(SEQ_PLAYER_FANFARE, ((float)CVarGetInteger(CVAR_SETTING("Volume.Fanfare"), 100) / 100.0f));
}

UIWidgets::PaddedSeparator();

if (UIWidgets::PaddedEnhancementSliderInt("Sound Effects Volume: %d %%", "##Sound_Effect_Vol", CVAR_SETTING("Volume.SFX"), 0, 100, "", 100, true, false, true)) {
Audio_SetGameVolume(SEQ_PLAYER_SFX, ((float)CVarGetInteger(CVAR_SETTING("Volume.SFX"), 100) / 100.0f));
}

UIWidgets::PaddedSeparator();

static std::unordered_map<Ship::AudioBackend, const char*> audioBackendNames = {
{ Ship::AudioBackend::WASAPI, "Windows Audio Session API" },
{ Ship::AudioBackend::SDL, "SDL" }
Expand Down Expand Up @@ -562,10 +577,10 @@ void DrawSettingsMenu() {

if (ImGui::BeginMenu("Accessibility")) {
#if defined(_WIN32) || defined(__APPLE__)
UIWidgets::PaddedEnhancementCheckbox("Text to Speech", CVAR_SETTING("A11yTTS"));
UIWidgets::EnhancementCheckbox("Text to Speech", CVAR_SETTING("A11yTTS"));
UIWidgets::Tooltip("Enables text to speech for in game dialog");
#endif
UIWidgets::PaddedEnhancementCheckbox("Disable Idle Camera Re-Centering", CVAR_SETTING("A11yDisableIdleCam"));
UIWidgets::PaddedEnhancementCheckbox("Disable Idle Camera Re-Centering", CVAR_SETTING("A11yDisableIdleCam"), true, false);
UIWidgets::Tooltip("Disables the automatic re-centering of the camera when idle.");

ImGui::EndMenu();
Expand All @@ -584,11 +599,20 @@ void DrawSettingsMenu() {

ImGui::Text("Position");
UIWidgets::EnhancementCombobox(CVAR_SETTING("Notifications.Position"), notificationPosition, 0);

UIWidgets::PaddedSeparator();

UIWidgets::EnhancementSliderFloat("Duration: %.1f seconds", "##NotificationDuration", CVAR_SETTING("Notifications.Duration"), 3.0f, 30.0f, "", 10.0f, false, true, false);

UIWidgets::PaddedSeparator();

UIWidgets::EnhancementSliderFloat("BG Opacity: %.1f %%", "##NotificaitonBgOpacity", CVAR_SETTING("Notifications.BgOpacity"), 0.0f, 1.0f, "", 0.5f, true, true, false);

UIWidgets::PaddedSeparator();

UIWidgets::EnhancementSliderFloat("Size: %.1f", "##NotificaitonSize", CVAR_SETTING("Notifications.Size"), 1.0f, 20.0f, "", 1.8f, false, true, false);

UIWidgets::Spacer(0);
UIWidgets::PaddedSeparator();

if (ImGui::Button("Test Notification", ImVec2(-1.0f, 0.0f))) {
Notification::Emit({
Expand Down Expand Up @@ -1689,7 +1713,6 @@ void DrawEnhancementsMenu() {
}
}

UIWidgets::Spacer(0);
if (UIWidgets::PaddedEnhancementCheckbox("Hurt Container Mode", CVAR_ENHANCEMENT("HurtContainer"), true, false)) {
UpdateHurtContainerModeState(CVarGetInteger(CVAR_ENHANCEMENT("HurtContainer"), 0));
}
Expand Down

0 comments on commit fdfe0f3

Please sign in to comment.