void Game::quit() { m_running = false; // Save configuration to settings file IniParser config; config.seek_section("Wallbreaker"); config.set("highscore", Settings::highscore); config.set("app_width", m_window.getSize().x); config.set("app_height", m_window.getSize().y); config.set("sound", SoundSystem::isSoundEnabled()); config.set("music", SoundSystem::isMusicEnabled()); config.save(m_app_dir + WB_SETTINGS_FILE); }
void UserSettings::saveToConfig(IniParser& config) { config.seekSection("Settings"); config.set("panel_on_top", panel_on_top); config.set("language", I18n::getInstance().getCurrentLanguage()); config.seekSection("Player"); config.set("current_level", LevelManager::getInstance().getCurrent()); config.set("last_unlocked_level", LevelManager::getInstance().getLastUnlocked()); config.set("credits", s_credits); config.set("arcade_highscore", s_highscore); config.set("lvl_laser", s_items[Item::WEAPON]); config.set("lvl_shield", s_items[Item::SHIELD]); config.set("lvl_hull", s_items[Item::HULL]); config.set("lvl_engine", s_items[Item::ENGINE]); config.set("lvl_heatsink", s_items[Item::HEATSINK]); config.seekSection("Keyboard"); config.set("move_up", Input::getKeyBinding(Action::UP)); config.set("move_down", Input::getKeyBinding(Action::DOWN)); config.set("move_left", Input::getKeyBinding(Action::LEFT)); config.set("move_right", Input::getKeyBinding(Action::RIGHT)); config.set("laser", Input::getKeyBinding(Action::USE_LASER)); config.set("cooler", Input::getKeyBinding(Action::USE_COOLER)); config.set("missile", Input::getKeyBinding(Action::USE_MISSILE)); config.seekSection("Joystick"); config.set("pause", Input::getButtonBinding(Action::PAUSE)); config.set("laser", Input::getButtonBinding(Action::USE_LASER)); config.set("cooler", Input::getButtonBinding(Action::USE_COOLER)); config.set("missile", Input::getButtonBinding(Action::USE_MISSILE)); config.set("sensitivity", Input::getJoystickDeadzone()); config.seekSection("Audio"); config.set("enable_music", SoundSystem::isMusicEnabled()); config.set("music_volume", SoundSystem::getMusicVolume()); config.set("enable_sound", SoundSystem::isSoundEnabled()); config.set("sound_volume", SoundSystem::getSoundVolume()); }