#include "supertux/menu/language_menu.hpp"
#include "supertux/menu/menu_storage.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%");
magnification->list.push_back("160%");
magnification->list.push_back("200%");
magnification->list.push_back("250%");
+ 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 = magnification->list.begin(); i != magnification->list.end(); ++i)
+ {
+ if (*i == magn)
+ {
+ magnification->selected = count;
+ magn.clear();
+ break;
+ }
+
+ ++count;
+ }
+ if (!magn.empty()) //magnification not in our list but accept anyway
+ {
+ magnification->selected = magnification->list.size();
+ magnification->list.push_back(magn);
+ }
+ }
+
SDL_Rect** modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_OPENGL);
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);
+ }
+
+ std::ostringstream out;
+ out << g_config->fullscreen_size.width << "x" << g_config->fullscreen_size.height;
+ std::string fllscrn_sz = out.str();
+ size_t cnt = 0;
+ for (std::vector<std::string>::iterator i = fullscreen_res->list.begin(); i != fullscreen_res->list.end(); ++i)
+ {
+ if (*i == fllscrn_sz)
+ {
+ fllscrn_sz.clear();
+ fullscreen_res->selected = cnt;
+ break;
+ }
+ ++cnt;
+ }
+ if (!fllscrn_sz.empty())
+ {
+ fullscreen_res->selected = fullscreen_res->list.size();
+ fullscreen_res->list.push_back(fllscrn_sz);
}
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");
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->list.begin(); i != aspect->list.end(); ++i)
{
if(*i == aspect_ratio)
{
aspect_ratio.clear();
+ aspect->selected = cnt;
break;
}
+ ++cnt;
}
if (!aspect_ratio.empty())
switch (item->id) {
case MNID_ASPECTRATIO:
{
- if (item->list[item->selected] == "auto")
+ if (item->list[item->selected] == _("auto"))
{
g_config->aspect_size = Size(0, 0); // Magic values
Renderer::instance()->apply_config();
break;
case MNID_MAGNIFICATION:
- if (item->list[item->selected] == "auto")
+ if (item->list[item->selected] == _("auto"))
{
g_config->magnification = 0.0f; // Magic value
}