From: Ingo Ruhnke Date: Wed, 21 May 2008 13:29:33 +0000 (+0000) Subject: Made screen-fill vs black-border an option X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5a8cc56bceb65bd27a8f7d4b7335bba838f91163;p=supertux.git Made screen-fill vs black-border an option SVN-Revision: 5495 --- diff --git a/src/gameconfig.cpp b/src/gameconfig.cpp index 728b2b838..94e7f9f6e 100644 --- a/src/gameconfig.cpp +++ b/src/gameconfig.cpp @@ -53,6 +53,7 @@ Config::Config() fullscreen_height = 600; magnification = 1.0f; + fill_screen = false; aspect_width = 4; aspect_height = 3; @@ -96,6 +97,8 @@ Config::load() config_video_lisp->get("aspect_width", aspect_width); config_video_lisp->get("aspect_height", aspect_height); + + config_video_lisp->get("fill_screen", fill_screen); } const lisp::Lisp* config_audio_lisp = config_lisp->get_lisp("audio"); @@ -140,6 +143,8 @@ Config::save() writer.write_int("aspect_width", aspect_width); writer.write_int("aspect_height", aspect_height); + writer.write_bool("fill_screen", fill_screen); + writer.end_list("video"); writer.start_list("audio"); diff --git a/src/gameconfig.hpp b/src/gameconfig.hpp index bdf8725eb..8456cc469 100644 --- a/src/gameconfig.hpp +++ b/src/gameconfig.hpp @@ -49,6 +49,7 @@ public: int aspect_height; float magnification; + bool fill_screen; bool use_fullscreen; VideoSystem video; diff --git a/src/options_menu.cpp b/src/options_menu.cpp index 9bd765b0b..2e9709442 100644 --- a/src/options_menu.cpp +++ b/src/options_menu.cpp @@ -36,6 +36,7 @@ enum OptionsMenuIDs { MNID_FULLSCREEN_RESOLUTION, MNID_MAGINFICATION, MNID_ASPECTRATIO, + MNID_FILL_SCREEN, MNID_PROFILES, MNID_SOUND, MNID_MUSIC @@ -134,7 +135,8 @@ OptionsMenu::OptionsMenu() MenuItem* maginfication = add_string_select(MNID_MAGINFICATION, _("Maginfication")); maginfication->set_help(_("Change the magnification of the game area")); - // These values go from screen:640/projection:1600 to screen:1600/projection:640 + // These values go from screen:640/projection:1600 to + // screen:1600/projection:640 (i.e. 640, 800, 1024, 1280, 1600) maginfication->list.push_back("40%"); maginfication->list.push_back("50%"); maginfication->list.push_back("62.5%"); @@ -145,6 +147,11 @@ OptionsMenu::OptionsMenu() maginfication->list.push_back("200%"); maginfication->list.push_back("250%"); + add_toggle(MNID_FILL_SCREEN, _("Fill Screen"), config->fill_screen) + ->set_help(_("With small magnification you have the choice between either " + "adding black borders around the screen or limiting it to the " + "smallest possible magnification, so that it still fills the screen")); + SDL_Rect** modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_OPENGL); if (modes == (SDL_Rect **)0) @@ -228,6 +235,13 @@ void OptionsMenu::menu_action(MenuItem* item) { switch (item->id) { + case MNID_FILL_SCREEN: + config->fill_screen = options_menu->is_toggled(MNID_FILL_SCREEN); + Renderer::instance()->apply_config(); + Menu::recalc_pos(); + config->save(); + break; + case MNID_ASPECTRATIO: { if(sscanf(item->list[item->selected].c_str(), "%d:%d", &config->aspect_width, &config->aspect_height) == 2) diff --git a/src/video/gl_renderer.cpp b/src/video/gl_renderer.cpp index 2d928340d..7704af5c3 100644 --- a/src/video/gl_renderer.cpp +++ b/src/video/gl_renderer.cpp @@ -605,7 +605,7 @@ Renderer::apply_config() int max_width = 1600; // FIXME: Maybe 1920 is ok too int max_height = 1200; - if (0) + if (config->fill_screen) { // This scales SCREEN_WIDTH/SCREEN_HEIGHT so that they never excede // max_width/max_height