25 std::function<
void(
GameState)> changeState)
26 : _uiRegistry(UiRegistry),
28 _translationManager(translationManager),
30 _uiFactory(uiFactory),
31 _changeState(changeState)
44 "assets/fonts/main.ttf",
54 "assets/fonts/main.ttf",
60 {540.0f, yPos + 3.0f},
76 "assets/fonts/main.ttf",
82 {540.0f, yPos + 3.0f},
98 "assets/fonts/main.ttf",
104 {540.0f, yPos + 3.0f},
109 [
this](
float value) {
120 "assets/fonts/main.ttf",
128 std::vector<std::string>{
"English",
"Français",
"Español",
"Deutsch",
"Italiano"},
133 log::info(
"Language changed to: {}. Changes will apply on next scene load.", index);
143 "assets/fonts/main.ttf",
147 std::vector<std::string> colorblindOptions = {
160 [
this, colorblindOptions = colorblindOptions](
int index) {
172 "assets/fonts/main.ttf",
176 std::vector<std::string> difficultyOptions = {
188 [
this, difficultyOptions = difficultyOptions](
int index) {
190 log::info(
"Solo difficulty set to: {}", difficultyOptions[index]);
240 if (
const auto* kp = e.getIf<sf::Event::KeyPressed>()) {
241 if (kp->code == sf::Keyboard::Key::Escape) {
System to handle network-related operations on the client side.
Manages game settings and preferences.
void setDifficulty(Difficulty difficulty)
Language getLanguage() const
void setMusicVolume(float volume)
float getMusicVolume() const
Difficulty getDifficulty() const
ColorBlindMode getColorBlindMode() const
void setSfxVolume(float volume)
void setLanguage(Language lang)
float getMasterVolume() const
void setColorBlindMode(ColorBlindMode mode)
bool save(const std::string &filename="config/settings.cfg")
void setMasterVolume(float volume)
float getSfxVolume() const
Manages game translations for all UI elements.
std::string get(const std::string &key) const
Get translated string for a key.
bool loadLanguage(Language language)
Load translations for a specific language.
Factory class for creating UI components in the ECS registry.
static ecs::Entity createText(ecs::Registry ®istry, const position &position, const std::string &content, const std::string &fontPath, unsigned int fontSize, const std::uint8_t zIndex=0, const color &textColor={255, 255, 255})
static ecs::Entity createButton(ecs::Registry ®istry, const position &position, const size &size, const std::string &label, std::function< void()> onClick=nullptr)
Create a button UI component.
static ecs::Entity createDropdown(ecs::Registry ®istry, const position &position, const size &size, const std::vector< std::string > &options, const int selectedIndex, std::function< void(int index)> onSelect=nullptr)
static ecs::Entity createSlider(ecs::Registry ®istry, const position &position, const size &size, float minValue, float maxValue, float initialValue, std::function< void(float)> onChange=nullptr)
ecs::Registry & _uiRegistry
Reference to the ECS registry.
void update(float dt) override
Update the scene state.
ChangeStateFn _changeState
Function to change the game state.
SettingsScene(ecs::Registry &UiRegistry, Settings &settings, TranslationManager &translationManager, NetworkSyncSystem &network, graphics::UiFactory &uiFactory, std::function< void(GameState)> changeState)
Constructor for SettingsScene.
TranslationManager & _translationManager
Reference to the translation manager.
void onExit() override
Called when the scene is exited.
Settings & _settings
Reference to the application settings.
void handleEvent(const sf::Event &event) override
Handle an incoming event.
void onEnter() override
Called when the scene is entered.
graphics::UiFactory & _uiFactory
UI Factory for creating UI components.
ColorBlindMode
Color blind assistance modes.
Difficulty
Game difficulty levels (solo mode only)
@ GamepadSettings
Gamepad settings configuration state.
@ KeyBindings
Key bindings configuration state.
Language
Supported languages.
void info(LogFmt< std::type_identity_t< Args >... > fmt, Args &&...args) noexcept
Log an informational message.