X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fmenu%2Foptions_menu.cpp;h=8e1ce9dc0b85e83aef22d84fabc4787ece398358;hb=eaa1442b14b723903bf991d5356a660913b961ed;hp=c0991c2c1e36109173f0e3e156c79c0cab3c739e;hpb=4c1a64930e8915ef23c6d8025a1ecadf4826264d;p=supertux.git diff --git a/src/supertux/menu/options_menu.cpp b/src/supertux/menu/options_menu.cpp index c0991c2c1..8e1ce9dc0 100644 --- a/src/supertux/menu/options_menu.cpp +++ b/src/supertux/menu/options_menu.cpp @@ -38,7 +38,8 @@ enum OptionsMenuIDs { MNID_MAGNIFICATION, MNID_ASPECTRATIO, MNID_SOUND, - MNID_MUSIC + MNID_MUSIC, + MNID_DEVELOPER_MODE }; OptionsMenu::OptionsMenu(bool complete) @@ -124,13 +125,16 @@ OptionsMenu::OptionsMenu(bool complete) } fullscreen_res->list.push_back("Desktop"); - std::ostringstream out; std::string fullscreen_size_str = "Desktop"; - if (g_config->fullscreen_size != Size(0, 0)) { - out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height << "@" << g_config->fullscreen_refresh_rate; - fullscreen_size_str = out.str(); + std::ostringstream out; + if (g_config->fullscreen_size != Size(0, 0)) + { + out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height << "@" << g_config->fullscreen_refresh_rate; + fullscreen_size_str = out.str(); + } } + size_t cnt = 0; for (std::vector::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i) { @@ -163,16 +167,16 @@ OptionsMenu::OptionsMenu(bool complete) std::ostringstream out; out << g_config->aspect_size.width << ":" << g_config->aspect_size.height; std::string aspect_ratio = out.str(); - size_t cnt = 0; + size_t cnt_ = 0; for(std::vector::iterator i = aspect->list.begin(); i != aspect->list.end(); ++i) { if(*i == aspect_ratio) { aspect_ratio.clear(); - aspect->selected = cnt; + aspect->selected = cnt_; break; } - ++cnt; + ++cnt_; } if (!aspect_ratio.empty()) @@ -182,7 +186,7 @@ OptionsMenu::OptionsMenu(bool complete) } } - if (sound_manager->is_audio_enabled()) { + if (SoundManager::current()->is_audio_enabled()) { add_toggle(MNID_SOUND, _("Sound"), g_config->sound_enabled) ->set_help(_("Disable all sound effects")); add_toggle(MNID_MUSIC, _("Music"), g_config->music_enabled) @@ -197,6 +201,12 @@ OptionsMenu::OptionsMenu(bool complete) add_submenu(_("Setup Joystick"), MenuStorage::JOYSTICK_MENU) ->set_help(_("Configure joystick control-action mappings")); + + if (g_config->developer_mode) + { + add_toggle(MNID_DEVELOPER_MODE, _("Developer Mode"), g_config->developer_mode); + } + add_hl(); add_back(_("Back")); } @@ -214,13 +224,13 @@ OptionsMenu::menu_action(MenuItem* item) if (item->list[item->selected] == _("auto")) { g_config->aspect_size = Size(0, 0); // Magic values - Renderer::instance()->apply_config(); + VideoSystem::current()->get_renderer().apply_config(); MenuManager::instance().on_window_resize(); } else if (sscanf(item->list[item->selected].c_str(), "%d:%d", &g_config->aspect_size.width, &g_config->aspect_size.height) == 2) { - Renderer::instance()->apply_config(); + VideoSystem::current()->get_renderer().apply_config(); MenuManager::instance().on_window_resize(); } else @@ -239,7 +249,7 @@ OptionsMenu::menu_action(MenuItem* item) { g_config->magnification /= 100.0f; } - Renderer::instance()->apply_config(); + VideoSystem::current()->get_renderer().apply_config(); MenuManager::instance().on_window_resize(); break; @@ -268,7 +278,7 @@ OptionsMenu::menu_action(MenuItem* item) case MNID_FULLSCREEN: if(g_config->use_fullscreen != is_toggled(MNID_FULLSCREEN)) { g_config->use_fullscreen = !g_config->use_fullscreen; - Renderer::instance()->apply_config(); + VideoSystem::current()->get_renderer().apply_config(); MenuManager::instance().on_window_resize(); g_config->save(); } @@ -277,7 +287,7 @@ OptionsMenu::menu_action(MenuItem* item) case MNID_SOUND: if(g_config->sound_enabled != is_toggled(MNID_SOUND)) { g_config->sound_enabled = !g_config->sound_enabled; - sound_manager->enable_sound(g_config->sound_enabled); + SoundManager::current()->enable_sound(g_config->sound_enabled); g_config->save(); } break; @@ -285,19 +295,19 @@ OptionsMenu::menu_action(MenuItem* item) case MNID_MUSIC: if(g_config->music_enabled != is_toggled(MNID_MUSIC)) { g_config->music_enabled = !g_config->music_enabled; - sound_manager->enable_music(g_config->music_enabled); + SoundManager::current()->enable_music(g_config->music_enabled); g_config->save(); } break; + case MNID_DEVELOPER_MODE: + g_config->developer_mode = is_toggled(MNID_DEVELOPER_MODE); + log_info << "developer mode: " << g_config->developer_mode << std::endl; + break; + default: break; } } -void -OptionsMenu::check_menu() -{ -} - /* EOF */