void EditorLevelsetMenu::initialize() { levelset_type = world->m_is_levelset ? 1 : 0; add_label(_("Level subset properties")); add_hl(); add_textfield(_("Name"), &(world->m_title)); add_textfield(_("Description"), &(world->m_description)); add_string_select(1, _("Type"), &levelset_type, {_("Worldmap"), _("Levelset")}); add_hl(); add_back(_("OK")); }
EditorMenu::EditorMenu() { bool worldmap = Editor::current()->get_worldmap_mode(); bool is_world = Editor::current()->get_world(); std::vector<std::string> snap_grid_sizes; snap_grid_sizes.push_back(_("1/8 tile (4px)")); snap_grid_sizes.push_back(_("1/4 tile (8px)")); snap_grid_sizes.push_back(_("1/2 tile (16px)")); snap_grid_sizes.push_back(_("1 tile (32px)")); add_label(_("Level Editor")); add_hl(); add_entry(MNID_RETURNTOEDITOR, _("Return to editor")); add_entry(MNID_SAVELEVEL, worldmap ? _("Save current worldmap") : _("Save current level")); if (!worldmap) { add_entry(MNID_TESTLEVEL, _("Test the level")); } else { add_entry(MNID_TESTLEVEL, _("Test the worldmap")); } if (is_world) { add_entry(MNID_LEVELSEL, _("Edit another level")); } add_entry(MNID_LEVELSETSEL, _("Choose another level subset")); add_string_select(-1, _("Grid size"), &EditorInputCenter::selected_snap_grid_size, snap_grid_sizes); add_toggle(-1, _("Render lighting (F6)"), &DrawingContext::render_lighting); add_toggle(-1, _("Snap objects to grid (F7)"), &EditorInputCenter::snap_to_grid); add_toggle(-1, _("Show grid (F8)"), &EditorInputCenter::render_grid); add_toggle(-1, _("Render background"), &EditorInputCenter::render_background); add_toggle(-1, _("Show scroller (F9)"), &EditorScroller::rendered); add_submenu(worldmap ? _("Worldmap properties") : _("Level properties"), MenuStorage::EDITOR_LEVEL_MENU); add_hl(); add_entry(MNID_QUITEDITOR, _("Exit level editor")); }
void BadguySelectMenu::refresh_menu() { items.clear(); add_label(_("List of enemies")); add_hl(); add_string_select(-2, _("Enemy"), &selected, all_badguys); add_entry(-3, _("Add")); add_hl(); int i = 0; for (auto& badguy : *badguys) { add_entry(i, badguy); i++; } add_hl(); add_back(_("OK")); }
OptionsMenu::OptionsMenu(bool complete) : next_magnification(0), next_aspect_ratio(0), next_resolution(0), magnifications(), aspect_ratios(), resolutions() { add_label(_("Options")); add_hl(); magnifications.clear(); // These values go from screen:640/projection:1600 to // screen:1600/projection:640 (i.e. 640, 800, 1024, 1280, 1600) magnifications.push_back(_("auto")); magnifications.push_back("40%"); magnifications.push_back("50%"); magnifications.push_back("62.5%"); magnifications.push_back("80%"); magnifications.push_back("100%"); magnifications.push_back("125%"); magnifications.push_back("160%"); magnifications.push_back("200%"); magnifications.push_back("250%"); // Gets the actual magnification: if (g_config->magnification != 0.0f) //auto { std::ostringstream out; out << (g_config->magnification*100) << "%"; std::string magn = out.str(); size_t count = 0; for (std::vector<std::string>::iterator i = magnifications.begin(); i != magnifications.end(); ++i) { if (*i == magn) { next_magnification = count; magn.clear(); break; } ++count; } if (!magn.empty()) //magnification not in our list but accept anyway { next_magnification = magnifications.size(); magnifications.push_back(magn); } } aspect_ratios.clear(); aspect_ratios.push_back(_("auto")); aspect_ratios.push_back("5:4"); aspect_ratios.push_back("4:3"); aspect_ratios.push_back("16:10"); aspect_ratios.push_back("16:9"); aspect_ratios.push_back("1368:768"); // Gets the actual aspect ratio: if (g_config->aspect_size != Size(0, 0)) //auto { std::ostringstream out; out << g_config->aspect_size.width << ":" << g_config->aspect_size.height; std::string aspect_ratio = out.str(); size_t cnt_ = 0; for(std::vector<std::string>::iterator i = aspect_ratios.begin(); i != aspect_ratios.end(); ++i) { if(*i == aspect_ratio) { aspect_ratio.clear(); next_aspect_ratio = cnt_; break; } ++cnt_; } if (!aspect_ratio.empty()) { next_aspect_ratio = aspect_ratios.size(); aspect_ratios.push_back(aspect_ratio); } } resolutions.clear(); int display_mode_count = SDL_GetNumDisplayModes(0); std::string last_display_mode; for(int i = 0; i < display_mode_count; ++i) { SDL_DisplayMode mode; int ret = SDL_GetDisplayMode(0, i, &mode); if (ret != 0) { log_warning << "failed to get display mode: " << SDL_GetError() << std::endl; } else { std::ostringstream out; out << mode.w << "x" << mode.h; if(mode.refresh_rate) out << "@" << mode.refresh_rate; if(last_display_mode == out.str()) continue; last_display_mode = out.str(); resolutions.insert(resolutions.begin(), out.str()); } } resolutions.push_back("Desktop"); std::string fullscreen_size_str = "Desktop"; { std::ostringstream out; if (g_config->fullscreen_size != Size(0, 0)) { out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height; if (g_config->fullscreen_refresh_rate) out << "@" << g_config->fullscreen_refresh_rate; fullscreen_size_str = out.str(); } } size_t cnt = 0; for (std::vector<std::string>::iterator i = resolutions.begin(); i != resolutions.end(); ++i) { if (*i == fullscreen_size_str) { fullscreen_size_str.clear(); next_resolution = cnt; break; } ++cnt; } if (!fullscreen_size_str.empty()) { next_resolution = resolutions.size(); resolutions.push_back(fullscreen_size_str); } if (complete) { // Language and profile changes are only be possible in the // main menu, since elsewhere it might not always work fully add_submenu(_("Select Language"), MenuStorage::LANGUAGE_MENU) ->set_help(_("Select a different language to display text in")); add_submenu(_("Select Profile"), MenuStorage::PROFILE_MENU) ->set_help(_("Select a profile to play with")); } add_toggle(MNID_FULLSCREEN,_("Fullscreen"), &g_config->use_fullscreen) ->set_help(_("Fill the entire screen")); MenuItem* fullscreen_res = add_string_select(MNID_FULLSCREEN_RESOLUTION, _("Resolution"), &next_resolution, resolutions); fullscreen_res->set_help(_("Determine the resolution used in fullscreen mode (you must toggle fullscreen to complete the change)")); MenuItem* magnification = add_string_select(MNID_MAGNIFICATION, _("Magnification"), &next_magnification, magnifications); magnification->set_help(_("Change the magnification of the game area")); MenuItem* aspect = add_string_select(MNID_ASPECTRATIO, _("Aspect Ratio"), &next_aspect_ratio, aspect_ratios); aspect->set_help(_("Adjust the aspect ratio")); 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) ->set_help(_("Disable all music")); } else { add_inactive( _("Sound (disabled)")); add_inactive( _("Music (disabled)")); } add_submenu(_("Setup Keyboard"), MenuStorage::KEYBOARD_MENU) ->set_help(_("Configure key-action mappings")); add_submenu(_("Setup Joystick"), MenuStorage::JOYSTICK_MENU) ->set_help(_("Configure joystick control-action mappings")); MenuItem* enable_transitions = add_toggle(MNID_TRANSITIONS, _("Enable transitions"), &g_config->transitions_enabled); enable_transitions->set_help(_("Enable screen transitions and smooth menu animation")); if (g_config->developer_mode) { add_toggle(MNID_DEVELOPER_MODE, _("Developer Mode"), &g_config->developer_mode); } if (g_config->is_christmas() || g_config->christmas_mode) { add_toggle(MNID_CHRISTMAS_MODE, _("Christmas Mode"), &g_config->christmas_mode); } add_hl(); add_back(_("Back")); }