fullscreen_height = 600;
magnification = 1.0f;
- stretch_to_window = false;
aspect_width = 4;
aspect_height = 3;
config_video_lisp->get("aspect_width", aspect_width);
config_video_lisp->get("aspect_height", aspect_height);
-
- config_video_lisp->get("stretch_to_window", stretch_to_window);
}
const lisp::Lisp* config_audio_lisp = config_lisp->get_lisp("audio");
writer.write_int("aspect_width", aspect_width);
writer.write_int("aspect_height", aspect_height);
- writer.write_bool("stretch_to_window", stretch_to_window);
-
writer.end_list("video");
writer.start_list("audio");
int aspect_height;
float magnification;
- bool stretch_to_window;
bool use_fullscreen;
VideoSystem video;
}
else
{
- int aspect_width = 4;
- int aspect_height = 3;
- if(sscanf(argv[i], "%d:%d", &aspect_width, &aspect_height) != 2) {
- print_usage(argv[0]);
- throw std::runtime_error("Invalid aspect spec, should be WIDTH:HEIGHT");
- } else {
- float aspect_ratio = static_cast<double>(config->aspect_width) /
- static_cast<double>(config->aspect_height);
-
- // use aspect ratio to calculate logical resolution
- if (aspect_ratio > 1) {
- config->aspect_width = static_cast<int> (600 * aspect_ratio + 0.5);
- config->aspect_height = 600;
- } else {
- config->aspect_width = 600;
- config->aspect_height = static_cast<int> (600 * 1/aspect_ratio + 0.5);
+ int aspect_width = 0;
+ int aspect_height = 0;
+ if (strcmp(argv[i], "auto") == 0)
+ {
+ aspect_width = 0;
+ aspect_height = 0;
+ }
+ else if (sscanf(argv[i], "%d:%d", &aspect_width, &aspect_height) != 2)
+ {
+ print_usage(argv[0]);
+ throw std::runtime_error("Invalid aspect spec, should be WIDTH:HEIGHT or auto");
+ }
+ else
+ {
+ float aspect_ratio = static_cast<double>(config->aspect_width) /
+ static_cast<double>(config->aspect_height);
+
+ // use aspect ratio to calculate logical resolution
+ if (aspect_ratio > 1) {
+ config->aspect_width = static_cast<int> (600 * aspect_ratio + 0.5);
+ config->aspect_height = 600;
+ } else {
+ config->aspect_width = 600;
+ config->aspect_height = static_cast<int> (600 * 1/aspect_ratio + 0.5);
+ }
}
- }
}
} else if(arg == "--show-fps") {
config->show_fps = true;
MNID_FULLSCREEN_RESOLUTION,
MNID_MAGNIFICATION,
MNID_ASPECTRATIO,
- MNID_STRETCH_TO_WINDOW,
MNID_PROFILES,
MNID_SOUND,
MNID_MUSIC
magnification->list.push_back("200%");
magnification->list.push_back("250%");
- add_toggle(MNID_STRETCH_TO_WINDOW, _("Stretch to Window"), config->stretch_to_window)
- ->set_help(_("Use the fullscreen resolution and stretch SuperTux to fill the given window"));
-
SDL_Rect** modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_OPENGL);
if (modes == (SDL_Rect **)0)
aspect->list.push_back("16:9");
aspect->list.push_back("1368:768");
- std::ostringstream out;
- out << config->aspect_width << ":" << config->aspect_height;
- std::string aspect_ratio = out.str();
- for(std::vector<std::string>::iterator i = aspect->list.begin(); i != aspect->list.end(); ++i)
+ if (config->aspect_width != 0 && config->aspect_height != 0)
{
- if(*i == aspect_ratio)
+ std::ostringstream out;
+ out << config->aspect_width << ":" << config->aspect_height;
+ std::string aspect_ratio = out.str();
+ for(std::vector<std::string>::iterator i = aspect->list.begin(); i != aspect->list.end(); ++i)
{
- aspect_ratio.clear();
- break;
+ if(*i == aspect_ratio)
+ {
+ aspect_ratio.clear();
+ break;
+ }
}
- }
- if (!aspect_ratio.empty())
- {
- aspect->selected = aspect->list.size();
- aspect->list.push_back(aspect_ratio);
+ if (!aspect_ratio.empty())
+ {
+ aspect->selected = aspect->list.size();
+ aspect->list.push_back(aspect_ratio);
+ }
}
if (sound_manager->is_audio_enabled()) {
{
// This scales SCREEN_WIDTH/SCREEN_HEIGHT so that they never excede
// max_width/max_height
- if (config->stretch_to_window || (SCREEN_WIDTH > max_width || SCREEN_HEIGHT > max_height))
+ if (SCREEN_WIDTH > max_width || SCREEN_HEIGHT > max_height)
{
float scale1 = float(max_width)/SCREEN_WIDTH;
float scale2 = float(max_height)/SCREEN_HEIGHT;
<< (h-nh)/2 << " "
<< nw << "x" << nh << std::endl;
- if (config->stretch_to_window)
- {
- glViewport(0, 0, w, h);
- }
- else
- {
- glViewport(std::max(0, (w-nw)/2),
- std::max(0, (h-nh)/2),
- std::min(nw, w),
- std::min(nh, h));
- }
+ glViewport(std::max(0, (w-nw)/2),
+ std::max(0, (h-nh)/2),
+ std::min(nw, w),
+ std::min(nh, h));
}
if (0)