diff options
| author | untodesu <kirill@untode.su> | 2025-05-27 16:35:41 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-05-27 16:35:41 +0500 |
| commit | adbbe24b0941c369d52461418cef206fc895168e (patch) | |
| tree | 349141c1e81f1d1113d8bbd96525ff2cf37d691b /game/client/settings.cc | |
| parent | 29da2327c990ef0ad4347b0067f4556030bbb3dc (diff) | |
| download | voxelius-adbbe24b0941c369d52461418cef206fc895168e.tar.bz2 voxelius-adbbe24b0941c369d52461418cef206fc895168e.zip | |
GUI updates
- Update ImGui to latest release (v1.91.9b)
- Fixup splash using a deprecated ImGui function
- Hide some settings tabs when not available
- Fix sound config values getting trashed whenever sound system cannot
be initialized
Diffstat (limited to 'game/client/settings.cc')
| -rw-r--r-- | game/client/settings.cc | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/game/client/settings.cc b/game/client/settings.cc index d239532..12ce96c 100644 --- a/game/client/settings.cc +++ b/game/client/settings.cc @@ -18,20 +18,20 @@ constexpr static ImGuiWindowFlags WINDOW_FLAGS = ImGuiWindowFlags_NoBackground | constexpr static unsigned int NUM_LOCATIONS = static_cast<unsigned int>(settings_location::COUNT); enum class setting_type : unsigned int { - CHECKBOX = 0x0000U, // ConfigBoolean - INPUT_INT = 0x0001U, // ConfigNumber<int> - INPUT_FLOAT = 0x0002U, // ConfigNumber<float> - INPUT_UINT = 0x0003U, // ConfigNumber<unsigned int> - INPUT_STRING = 0x0004U, // ConfigString - SLIDER_INT = 0x0005U, // ConfigNumber<int> - SLIDER_FLOAT = 0x0006U, // ConfigNumber<float> - SLIDER_UINT = 0x0007U, // ConfigNumber<unsigned int> - STEPPER_INT = 0x0008U, // ConfigNumber<int> - STEPPER_UINT = 0x0009U, // ConfigNumber<unsigned int> - KEYBIND = 0x000AU, // ConfigKeyBind - GAMEPAD_AXIS = 0x000BU, // ConfigGamepadAxis - GAMEPAD_BUTTON = 0x000CU, // ConfigGamepadButton - LANGUAGE_SELECT = 0x000DU, // ConfigString internally + CHECKBOX = 0x0000U, ///< ConfigBoolean + INPUT_INT = 0x0001U, ///< ConfigNumber<int> + INPUT_FLOAT = 0x0002U, ///< ConfigNumber<float> + INPUT_UINT = 0x0003U, ///< ConfigNumber<unsigned int> + INPUT_STRING = 0x0004U, ///< ConfigString + SLIDER_INT = 0x0005U, ///< ConfigNumber<int> + SLIDER_FLOAT = 0x0006U, ///< ConfigNumber<float> + SLIDER_UINT = 0x0007U, ///< ConfigNumber<unsigned int> + STEPPER_INT = 0x0008U, ///< ConfigNumber<int> + STEPPER_UINT = 0x0009U, ///< ConfigNumber<unsigned int> + KEYBIND = 0x000AU, ///< ConfigKeyBind + GAMEPAD_AXIS = 0x000BU, ///< ConfigGamepadAxis + GAMEPAD_BUTTON = 0x000CU, ///< ConfigGamepadButton + LANGUAGE_SELECT = 0x000DU, ///< ConfigString internally }; class SettingValue { @@ -709,10 +709,12 @@ static void layout_input(void) ImGui::EndTabItem(); } - if(ImGui::BeginTabItem(str_input_gamepad.c_str())) { - globals::gui_keybind_ptr = nullptr; - layout_input_gamepad(); - ImGui::EndTabItem(); + if(gamepad::available) { + if(ImGui::BeginTabItem(str_input_gamepad.c_str())) { + globals::gui_keybind_ptr = nullptr; + layout_input_gamepad(); + ImGui::EndTabItem(); + } } if(ImGui::BeginTabItem(str_input_mouse.c_str())) { @@ -812,10 +814,12 @@ void settings::layout(void) ImGui::EndTabItem(); } - if(ImGui::BeginTabItem(str_tab_sound.c_str())) { - globals::gui_keybind_ptr = nullptr; - layout_sound(); - ImGui::EndTabItem(); + if(globals::sound_ctx && globals::sound_dev) { + if(ImGui::BeginTabItem(str_tab_sound.c_str())) { + globals::gui_keybind_ptr = nullptr; + layout_sound(); + ImGui::EndTabItem(); + } } ImGui::EndTabBar(); |
