group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
SettingsEditor Class Reference

Shared tabbed settings editor used by front-end screens and the pause menu. More...

#include <SettingsEditor.hpp>

Collaboration diagram for SettingsEditor:
[legend]

Classes

struct  ListeningBinding

Public Member Functions

void open (const UserSettings &settings)
 Open the editor with a fresh draft copied from live settings.
void close ()
 Close the editor and discard transient UI state.
bool isOpen () const
 True while the settings editor is active.
bool handleEscape (const UserSettings &settings)
 Handle Escape according to the current listening/dirty/modal state.
bool consumeEvent (const SDL_Event &event)
 Consume input events while the editor owns menu focus.
SettingsEditorResult render (UserSettings &settings, std::string_view settingsPath, float uiScale)
 Draw the tabbed editor inside the current ImGui window.

Private Types

enum class  Tab { General , Audio , KeyboardMouse , Controller }

Private Member Functions

void resetDraft (const UserSettings &settings)
void closeEditor ()
bool requestClose (const UserSettings &settings)
void requestDiscardConfirm ()
void apply (UserSettings &settings, std::string_view settingsPath, SettingsEditorResult &result)
void resetToDefaults (UserSettings &settings)
void restoreOriginalAudioSettings (UserSettings &settings)
void updateLiveAudioSettings (UserSettings &settings)
void renderGeneralTab ()
void renderAudioTab (UserSettings &settings)
void renderKeyboardMouseTab (float uiScale)
void renderControllerTab (float uiScale)
void renderBindingsTable (BindingDevice device, float uiScale)

Private Attributes

bool open_ = false
Tab activeTab_ = Tab::General
InputBindings draftBindings_ = InputBindings::defaults()
float draftMouseSensitivity_ = user_settings::kDefaultMouseSensitivity
float draftHorizontalFovDegrees_ = 110.0f
bool draftShowControllerBindings_ = false
float draftGamepadYawSensitivity_ = 6.0f
float draftGamepadPitchSensitivity_ = 6.0f
float draftGamepadLookDeadzone_ = 0.0f
float draftGamepadMoveDeadzone_ = 0.0f
bool draftAimAssistEnabled_ = true
float draftAimAssistStrength_ = 1.0f
bool draftGamepadSwapSticks_ = false
bool draftMuzzleFlashEnabled_ = true
float draftMusicVolume_ = 0.7f
float draftSfxVolume_ = 1.0f
std::string draftAudioOutputDeviceName_
std::string draftAudioInputDeviceName_
float originalMusicVolume_ = 0.7f
float originalSfxVolume_ = 1.0f
std::string originalAudioOutputDeviceName_
std::string originalAudioInputDeviceName_
bool dirty_ = false
std::optional< ListeningBindinglisteningBinding_
std::string statusMessage_
ConfirmModal confirm_

Detailed Description

Shared tabbed settings editor used by front-end screens and the pause menu.

Member Enumeration Documentation

◆ Tab

enum class SettingsEditor::Tab
strongprivate
Enumerator
General 
Audio 
KeyboardMouse 
Controller 

Member Function Documentation

◆ apply()

void SettingsEditor::apply ( UserSettings & settings,
std::string_view settingsPath,
SettingsEditorResult & result )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ close()

void SettingsEditor::close ( )

Close the editor and discard transient UI state.

Here is the call graph for this function:

◆ closeEditor()

void SettingsEditor::closeEditor ( )
private
Here is the caller graph for this function:

◆ consumeEvent()

bool SettingsEditor::consumeEvent ( const SDL_Event & event)

Consume input events while the editor owns menu focus.

Here is the call graph for this function:

◆ handleEscape()

bool SettingsEditor::handleEscape ( const UserSettings & settings)

Handle Escape according to the current listening/dirty/modal state.

Returns
True when the caller should close the settings page.
Here is the call graph for this function:

◆ isOpen()

bool SettingsEditor::isOpen ( ) const
nodiscard

True while the settings editor is active.

◆ open()

void SettingsEditor::open ( const UserSettings & settings)

Open the editor with a fresh draft copied from live settings.

Here is the call graph for this function:

◆ render()

SettingsEditorResult SettingsEditor::render ( UserSettings & settings,
std::string_view settingsPath,
float uiScale )

Draw the tabbed editor inside the current ImGui window.

Here is the call graph for this function:

◆ renderAudioTab()

void SettingsEditor::renderAudioTab ( UserSettings & settings)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderBindingsTable()

void SettingsEditor::renderBindingsTable ( BindingDevice device,
float uiScale )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderControllerTab()

void SettingsEditor::renderControllerTab ( float uiScale)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderGeneralTab()

void SettingsEditor::renderGeneralTab ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderKeyboardMouseTab()

void SettingsEditor::renderKeyboardMouseTab ( float uiScale)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestClose()

bool SettingsEditor::requestClose ( const UserSettings & settings)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestDiscardConfirm()

void SettingsEditor::requestDiscardConfirm ( )
private
Here is the caller graph for this function:

◆ resetDraft()

void SettingsEditor::resetDraft ( const UserSettings & settings)
private
Here is the caller graph for this function:

◆ resetToDefaults()

void SettingsEditor::resetToDefaults ( UserSettings & settings)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ restoreOriginalAudioSettings()

void SettingsEditor::restoreOriginalAudioSettings ( UserSettings & settings)
private
Here is the caller graph for this function:

◆ updateLiveAudioSettings()

void SettingsEditor::updateLiveAudioSettings ( UserSettings & settings)
private
Here is the caller graph for this function:

Member Data Documentation

◆ activeTab_

Tab SettingsEditor::activeTab_ = Tab::General
private

◆ confirm_

ConfirmModal SettingsEditor::confirm_
private

◆ dirty_

bool SettingsEditor::dirty_ = false
private

◆ draftAimAssistEnabled_

bool SettingsEditor::draftAimAssistEnabled_ = true
private

◆ draftAimAssistStrength_

float SettingsEditor::draftAimAssistStrength_ = 1.0f
private

◆ draftAudioInputDeviceName_

std::string SettingsEditor::draftAudioInputDeviceName_
private

◆ draftAudioOutputDeviceName_

std::string SettingsEditor::draftAudioOutputDeviceName_
private

◆ draftBindings_

InputBindings SettingsEditor::draftBindings_ = InputBindings::defaults()
private

◆ draftGamepadLookDeadzone_

float SettingsEditor::draftGamepadLookDeadzone_ = 0.0f
private

◆ draftGamepadMoveDeadzone_

float SettingsEditor::draftGamepadMoveDeadzone_ = 0.0f
private

◆ draftGamepadPitchSensitivity_

float SettingsEditor::draftGamepadPitchSensitivity_ = 6.0f
private

◆ draftGamepadSwapSticks_

bool SettingsEditor::draftGamepadSwapSticks_ = false
private

◆ draftGamepadYawSensitivity_

float SettingsEditor::draftGamepadYawSensitivity_ = 6.0f
private

◆ draftHorizontalFovDegrees_

float SettingsEditor::draftHorizontalFovDegrees_ = 110.0f
private

◆ draftMouseSensitivity_

float SettingsEditor::draftMouseSensitivity_ = user_settings::kDefaultMouseSensitivity
private

◆ draftMusicVolume_

float SettingsEditor::draftMusicVolume_ = 0.7f
private

◆ draftMuzzleFlashEnabled_

bool SettingsEditor::draftMuzzleFlashEnabled_ = true
private

◆ draftSfxVolume_

float SettingsEditor::draftSfxVolume_ = 1.0f
private

◆ draftShowControllerBindings_

bool SettingsEditor::draftShowControllerBindings_ = false
private

◆ listeningBinding_

std::optional<ListeningBinding> SettingsEditor::listeningBinding_
private

◆ open_

bool SettingsEditor::open_ = false
private

◆ originalAudioInputDeviceName_

std::string SettingsEditor::originalAudioInputDeviceName_
private

◆ originalAudioOutputDeviceName_

std::string SettingsEditor::originalAudioOutputDeviceName_
private

◆ originalMusicVolume_

float SettingsEditor::originalMusicVolume_ = 0.7f
private

◆ originalSfxVolume_

float SettingsEditor::originalSfxVolume_ = 1.0f
private

◆ statusMessage_

std::string SettingsEditor::statusMessage_
private

The documentation for this class was generated from the following files: