|
R-Type
Distributed multiplayer game engine in C++
|
Accessibility menu for configuring accessibility features. More...
#include <AccessibilityMenu.hpp>


Public Types | |
| enum class | ColorblindFilter { NONE , PROTANOPIA , DEUTERANOPIA , TRITANOPIA , MONOCHROMACY } |
| Colorblind filter types. More... | |
| enum class | Mode { FULLSCREEN , OVERLAY } |
| Display mode for the accessibility menu. More... | |
Public Member Functions | |
| AccessibilityMenu (UI::IUIFactory &uiFactory, Graphics::IGraphics &graphics) | |
| Construct a new AccessibilityMenu. | |
| ~AccessibilityMenu () override=default | |
| void | Initialize () override |
| Initialize UI elements. | |
| void | Update () override |
| Update menu state (should be called every frame). | |
| void | Render () override |
| Render menu (should be called every frame). | |
| void | SetMode (Mode mode) |
| Mode | GetMode () const |
| void | SetOverlayDimColor (unsigned int color) |
| unsigned int | GetOverlayDimColor () const |
| bool | ShouldDimBackground () const |
| void | SetColorblindFilter (ColorblindFilter filter) |
| Set the colorblind filter type. | |
| ColorblindFilter | GetColorblindFilter () const |
| Get the current colorblind filter. | |
| void | SetOnColorblindFilterChanged (std::function< void(ColorblindFilter)> callback) |
| Set callback invoked when colorblind filter changes. | |
| void | SetColorblindFilterSilent (ColorblindFilter filter) |
| Set colorblind filter without emitting callbacks. | |
| void | SetGameSpeed (float speed) |
| Set game speed multiplier (0.5 = 50% speed, 1.0 = normal) | |
| float | GetGameSpeed () const |
| Get current game speed multiplier. | |
| void | SetOnGameSpeedChanged (std::function< void(float)> callback) |
| Set callback invoked when game speed changes. | |
| void | SetGameSpeedSilent (float speed) |
| Set game speed without emitting callbacks. | |
| void | OpenKeyBindingsConfig () |
| Open key bindings configuration dialog. | |
| void | SetOnConfigureKeyBindings (std::function< void()> callback) |
| Set callback invoked when user wants to configure key bindings. | |
| void | SetOnBack (std::function< void()> callback) |
| Set callback invoked when Back is clicked. | |
| void | SetOnMainMenu (std::function< void()> callback) |
| Set callback invoked when "Main Menu" is clicked (overlay mode) | |
| void | RefreshVisuals () |
| Refresh button labels/colors to match current state. | |
Public Member Functions inherited from Game::BaseMenu | |
| BaseMenu (UI::IUIFactory &uiFactory) | |
| Constructor with UI factory reference. | |
| virtual | ~BaseMenu ()=default |
| Virtual destructor. | |
| virtual void | Show () |
| Show the menu. | |
| virtual void | Hide () |
| Hide the menu. | |
| virtual bool | IsVisible () const |
| Check if menu is currently visible. | |
| void | SetSoundEffectService (Audio::ISoundEffectService *soundService) |
| Set the sound effect service for playing UI sounds. | |
Private Member Functions | |
| void | UpdateColorblindFilterVisuals () |
| ColorblindFilter | NextColorblindFilter (ColorblindFilter current) const |
| const char * | ColorblindFilterToString (ColorblindFilter filter) const |
| float | ClampGameSpeed (float speed) const |
Private Attributes | |
| Graphics::IGraphics & | _graphics |
| Mode | _mode {Mode::FULLSCREEN} |
| ColorblindFilter | _colorblindFilter {ColorblindFilter::NONE} |
| float | _gameSpeed {1.0f} |
| unsigned int | _overlayDimColor {0x88000000} |
| std::function< void(ColorblindFilter)> | _onColorblindFilterChanged {} |
| std::function< void(float)> | _onGameSpeedChanged {} |
| std::function< void()> | _onConfigureKeyBindings {} |
| std::function< void()> | _onBack {} |
| std::function< void()> | _onMainMenu {} |
Static Private Attributes | |
| static constexpr size_t | COLORBLIND_FILTER_INDEX = 0 |
| static constexpr size_t | KEY_BINDINGS_INDEX = 1 |
| static constexpr size_t | BACK_INDEX = 2 |
| static constexpr size_t | MAIN_MENU_INDEX = 3 |
Additional Inherited Members | |
Protected Member Functions inherited from Game::BaseMenu | |
| std::function< void()> | WrapWithClickSound (std::function< void()> callback) |
| Wrap a callback to play click sound before executing. | |
| std::shared_ptr< UI::IButton > | CreateCenteredButton (const char *label, float offsetY, float width, float height, unsigned int backgroundColor, unsigned int hoverColor, std::function< void()> callback) |
| Create a button with standard styling and positioning. | |
Protected Attributes inherited from Game::BaseMenu | |
| UI::IUIFactory & | _uiFactory |
| std::shared_ptr< UI::IMenu > | _menu |
| Audio::ISoundEffectService * | _soundService {nullptr} |
Accessibility menu for configuring accessibility features.
Provides options for:
Definition at line 28 of file AccessibilityMenu.hpp.
|
strong |
Colorblind filter types.
| Enumerator | |
|---|---|
| NONE | No filter applied. |
| PROTANOPIA | Red-blind. |
| DEUTERANOPIA | Green-blind. |
| TRITANOPIA | Blue-blind. |
| MONOCHROMACY | Complete color blindness. |
Definition at line 33 of file AccessibilityMenu.hpp.
|
strong |
Display mode for the accessibility menu.
| Enumerator | |
|---|---|
| FULLSCREEN | Takes the whole window (main menu context) |
| OVERLAY | Displays over the game with a dimmed background. |
Definition at line 44 of file AccessibilityMenu.hpp.
|
explicit |
Construct a new AccessibilityMenu.
| uiFactory | UI factory used to create menus and buttons |
| graphics | Graphics interface for rendering |
Definition at line 14 of file AccessibilityMenu.cpp.
|
overridedefault |
|
private |
Definition at line 252 of file AccessibilityMenu.cpp.
Referenced by SetGameSpeed(), and SetGameSpeedSilent().
|
private |
Definition at line 235 of file AccessibilityMenu.cpp.
References DEUTERANOPIA, MONOCHROMACY, NONE, PROTANOPIA, and TRITANOPIA.
Referenced by SetColorblindFilter(), and UpdateColorblindFilterVisuals().
| AccessibilityMenu::ColorblindFilter Game::AccessibilityMenu::GetColorblindFilter | ( | ) | const |
Get the current colorblind filter.
Definition at line 135 of file AccessibilityMenu.cpp.
References _colorblindFilter.
| float Game::AccessibilityMenu::GetGameSpeed | ( | ) | const |
Get current game speed multiplier.
Definition at line 160 of file AccessibilityMenu.cpp.
References _gameSpeed.
| AccessibilityMenu::Mode Game::AccessibilityMenu::GetMode | ( | ) | const |
Definition at line 107 of file AccessibilityMenu.cpp.
References _mode.
| unsigned int Game::AccessibilityMenu::GetOverlayDimColor | ( | ) | const |
Definition at line 115 of file AccessibilityMenu.cpp.
References _overlayDimColor.
|
overridevirtual |
Initialize UI elements.
Implements Game::BaseMenu.
Definition at line 17 of file AccessibilityMenu.cpp.
References _colorblindFilter, Game::BaseMenu::_menu, _mode, _onBack, _onMainMenu, Game::BaseMenu::CreateCenteredButton(), Game::BaseMenu::Hide(), NextColorblindFilter(), OpenKeyBindingsConfig(), OVERLAY, RefreshVisuals(), and SetColorblindFilter().
Referenced by SetMode().

|
private |
Definition at line 217 of file AccessibilityMenu.cpp.
References DEUTERANOPIA, MONOCHROMACY, NONE, PROTANOPIA, and TRITANOPIA.
Referenced by Initialize().
| void Game::AccessibilityMenu::OpenKeyBindingsConfig | ( | ) |
Open key bindings configuration dialog.
Definition at line 173 of file AccessibilityMenu.cpp.
References _onConfigureKeyBindings, and LOG_INFO.
Referenced by Initialize().
| void Game::AccessibilityMenu::RefreshVisuals | ( | ) |
Refresh button labels/colors to match current state.
Definition at line 197 of file AccessibilityMenu.cpp.
References UpdateColorblindFilterVisuals().
Referenced by Initialize().

|
overridevirtual |
Render menu (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 77 of file AccessibilityMenu.cpp.
References _graphics, Game::BaseMenu::_menu, _mode, Graphics::IGraphics::DrawText(), Graphics::IGraphics::GetScreenWidth(), OVERLAY, and Game::BaseMenu::Render().

| void Game::AccessibilityMenu::SetColorblindFilter | ( | ColorblindFilter | filter | ) |
Set the colorblind filter type.
| filter | The filter to apply |
Definition at line 124 of file AccessibilityMenu.cpp.
References _colorblindFilter, _onColorblindFilterChanged, ColorblindFilterToString(), LOG_INFO, and UpdateColorblindFilterVisuals().
Referenced by Initialize().

| void Game::AccessibilityMenu::SetColorblindFilterSilent | ( | ColorblindFilter | filter | ) |
Set colorblind filter without emitting callbacks.
Definition at line 143 of file AccessibilityMenu.cpp.
References _colorblindFilter, and UpdateColorblindFilterVisuals().

| void Game::AccessibilityMenu::SetGameSpeed | ( | float | speed | ) |
Set game speed multiplier (0.5 = 50% speed, 1.0 = normal)
| speed | Speed multiplier (clamped between 0.25 and 1.0) |
Definition at line 149 of file AccessibilityMenu.cpp.
References _gameSpeed, _onGameSpeedChanged, ClampGameSpeed(), and LOG_INFO.

| void Game::AccessibilityMenu::SetGameSpeedSilent | ( | float | speed | ) |
Set game speed without emitting callbacks.
Definition at line 168 of file AccessibilityMenu.cpp.
References _gameSpeed, and ClampGameSpeed().

| void Game::AccessibilityMenu::SetMode | ( | Mode | mode | ) |
Definition at line 100 of file AccessibilityMenu.cpp.
References _mode, and Initialize().

| void Game::AccessibilityMenu::SetOnBack | ( | std::function< void()> | callback | ) |
Set callback invoked when Back is clicked.
Definition at line 188 of file AccessibilityMenu.cpp.
References _onBack.
| void Game::AccessibilityMenu::SetOnColorblindFilterChanged | ( | std::function< void(ColorblindFilter)> | callback | ) |
Set callback invoked when colorblind filter changes.
Definition at line 139 of file AccessibilityMenu.cpp.
References _onColorblindFilterChanged.
| void Game::AccessibilityMenu::SetOnConfigureKeyBindings | ( | std::function< void()> | callback | ) |
Set callback invoked when user wants to configure key bindings.
Definition at line 183 of file AccessibilityMenu.cpp.
References _onConfigureKeyBindings.
| void Game::AccessibilityMenu::SetOnGameSpeedChanged | ( | std::function< void(float)> | callback | ) |
Set callback invoked when game speed changes.
Definition at line 164 of file AccessibilityMenu.cpp.
References _onGameSpeedChanged.
| void Game::AccessibilityMenu::SetOnMainMenu | ( | std::function< void()> | callback | ) |
Set callback invoked when "Main Menu" is clicked (overlay mode)
Definition at line 192 of file AccessibilityMenu.cpp.
References _onMainMenu.
| void Game::AccessibilityMenu::SetOverlayDimColor | ( | unsigned int | color | ) |
Definition at line 111 of file AccessibilityMenu.cpp.
References _overlayDimColor.
| bool Game::AccessibilityMenu::ShouldDimBackground | ( | ) | const |
Definition at line 119 of file AccessibilityMenu.cpp.
References _mode, Game::BaseMenu::IsVisible(), and OVERLAY.

|
overridevirtual |
Update menu state (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 73 of file AccessibilityMenu.cpp.
References Game::BaseMenu::Update().

|
private |
Definition at line 201 of file AccessibilityMenu.cpp.
References _colorblindFilter, Game::BaseMenu::_menu, COLORBLIND_FILTER_INDEX, and ColorblindFilterToString().
Referenced by RefreshVisuals(), SetColorblindFilter(), and SetColorblindFilterSilent().

|
private |
Definition at line 156 of file AccessibilityMenu.hpp.
Referenced by GetColorblindFilter(), Initialize(), SetColorblindFilter(), SetColorblindFilterSilent(), and UpdateColorblindFilterVisuals().
|
private |
Definition at line 157 of file AccessibilityMenu.hpp.
Referenced by GetGameSpeed(), SetGameSpeed(), and SetGameSpeedSilent().
|
private |
Definition at line 153 of file AccessibilityMenu.hpp.
Referenced by Render().
|
private |
Definition at line 155 of file AccessibilityMenu.hpp.
Referenced by GetMode(), Initialize(), Render(), SetMode(), and ShouldDimBackground().
|
private |
Definition at line 164 of file AccessibilityMenu.hpp.
Referenced by Initialize(), and SetOnBack().
|
private |
Definition at line 161 of file AccessibilityMenu.hpp.
Referenced by SetColorblindFilter(), and SetOnColorblindFilterChanged().
|
private |
Definition at line 163 of file AccessibilityMenu.hpp.
Referenced by OpenKeyBindingsConfig(), and SetOnConfigureKeyBindings().
|
private |
Definition at line 162 of file AccessibilityMenu.hpp.
Referenced by SetGameSpeed(), and SetOnGameSpeedChanged().
|
private |
Definition at line 165 of file AccessibilityMenu.hpp.
Referenced by Initialize(), and SetOnMainMenu().
|
private |
Definition at line 158 of file AccessibilityMenu.hpp.
Referenced by GetOverlayDimColor(), and SetOverlayDimColor().
|
staticconstexprprivate |
Definition at line 170 of file AccessibilityMenu.hpp.
|
staticconstexprprivate |
Definition at line 168 of file AccessibilityMenu.hpp.
Referenced by UpdateColorblindFilterVisuals().
|
staticconstexprprivate |
Definition at line 169 of file AccessibilityMenu.hpp.
|
staticconstexprprivate |
Definition at line 171 of file AccessibilityMenu.hpp.