#include "supertux/menu/options_menu.hpp"
#include "audio/sound_manager.hpp"
-#include "control/joystickkeyboardcontroller.hpp"
-#include "gui/menu.hpp"
#include "gui/menu_manager.hpp"
-#include "gui/menu_item.hpp"
#include "supertux/gameconfig.hpp"
-#include "supertux/globals.hpp"
-#include "supertux/main.hpp"
-#include "supertux/menu/profile_menu.hpp"
+#include "supertux/menu/joystick_menu.hpp"
+#include "supertux/menu/keyboard_menu.hpp"
#include "supertux/menu/language_menu.hpp"
#include "supertux/menu/menu_storage.hpp"
-#include "util/gettext.hpp"
+#include "supertux/menu/profile_menu.hpp"
+#include "util/string_util.hpp"
#include "video/renderer.hpp"
+#include <algorithm>
+#include <sstream>
+
enum OptionsMenuIDs {
MNID_FULLSCREEN,
MNID_FULLSCREEN_RESOLUTION,
// These values go from screen:640/projection:1600 to
// screen:1600/projection:640 (i.e. 640, 800, 1024, 1280, 1600)
- magnification->list.push_back("auto");
+ magnification->list.push_back(_("auto"));
magnification->list.push_back("40%");
magnification->list.push_back("50%");
magnification->list.push_back("62.5%");
out << modes[i]->w << "x" << modes[i]->h;
fullscreen_res->list.push_back(out.str());
}
+
+ // On Ubuntu/Linux resolutions are returned from highest to
+ // lowest, so reverse them
+ std::sort(fullscreen_res->list.begin(), fullscreen_res->list.end(), StringUtil::numeric_less);
}
MenuItem* aspect = add_string_select(MNID_ASPECTRATIO, _("Aspect Ratio"));
aspect->set_help(_("Adjust the aspect ratio"));
- aspect->list.push_back("auto");
+ aspect->list.push_back(_("auto"));
aspect->list.push_back("5:4");
aspect->list.push_back("4:3");
aspect->list.push_back("16:10");
aspect->list.push_back("16:9");
aspect->list.push_back("1368:768");
- if (g_config->aspect_width != 0 && g_config->aspect_height != 0)
+ if (g_config->aspect_size != Size(0, 0))
{
std::ostringstream out;
- out << g_config->aspect_width << ":" << g_config->aspect_height;
+ out << g_config->aspect_size.width << ":" << g_config->aspect_size.height;
std::string aspect_ratio = out.str();
for(std::vector<std::string>::iterator i = aspect->list.begin(); i != aspect->list.end(); ++i)
{
add_inactive(MNID_MUSIC, _("Music (disabled)"));
}
- add_submenu(_("Setup Keyboard"), g_main_controller->get_key_options_menu())
+ add_submenu(_("Setup Keyboard"), MenuStorage::get_key_options_menu())
->set_help(_("Configure key-action mappings"));
- add_submenu(_("Setup Joystick") ,g_main_controller->get_joystick_options_menu())
+ add_submenu(_("Setup Joystick"), MenuStorage::get_joystick_options_menu())
->set_help(_("Configure joystick control-action mappings"));
add_hl();
add_back(_("Back"));
switch (item->id) {
case MNID_ASPECTRATIO:
{
- if (item->list[item->selected] == "auto")
+ if (item->list[item->selected] == _("auto"))
{
- g_config->aspect_width = 0; // Magic values
- g_config->aspect_height = 0;
+ g_config->aspect_size = Size(0, 0); // Magic values
Renderer::instance()->apply_config();
MenuManager::recalc_pos();
}
- else if(sscanf(item->list[item->selected].c_str(), "%d:%d", &g_config->aspect_width, &g_config->aspect_height) == 2)
+ 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();
MenuManager::recalc_pos();
break;
case MNID_MAGNIFICATION:
- if (item->list[item->selected] == "auto")
+ if (item->list[item->selected] == _("auto"))
{
g_config->magnification = 0.0f; // Magic value
}
break;
case MNID_FULLSCREEN_RESOLUTION:
- if(sscanf(item->list[item->selected].c_str(), "%dx%d", &g_config->fullscreen_width, &g_config->fullscreen_height) == 2)
+ if(sscanf(item->list[item->selected].c_str(), "%dx%d",
+ &g_config->fullscreen_size.width, &g_config->fullscreen_size.height) == 2)
{
// do nothing, changes are only applied when toggling fullscreen mode
}
}
}
+void
+OptionsMenu::check_menu()
+{
+}
+
/* EOF */