mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 02:03:41 +00:00
Allow to use the small-gui mode by starting wesnoth with --smallgui
The configure switch is still working, will remove it later
This commit is contained in:
parent
f4f82aa9dd
commit
4965ec95fa
@ -671,30 +671,21 @@ std::string load_game_dialog(display& disp, const config& game_config, bool* sho
|
||||
lmenu.add_pane(&save_preview);
|
||||
// create an option for whether the replay should be shown or not
|
||||
if(show_replay != NULL) {
|
||||
#ifdef USE_SMALL_GUI
|
||||
lmenu.add_option(_("Show replay"), false, gui::dialog::BUTTON_STANDARD);
|
||||
#else
|
||||
lmenu.add_option(_("Show replay"), false);
|
||||
#endif
|
||||
lmenu.add_option(_("Show replay"), false,
|
||||
game_config::small_gui ? gui::dialog::BUTTON_CHECKBOX : gui::dialog::BUTTON_STANDARD);
|
||||
}
|
||||
if(cancel_orders != NULL) {
|
||||
#ifdef USE_SMALL_GUI
|
||||
lmenu.add_option(_("Cancel orders"), false, gui::dialog::BUTTON_STANDARD);
|
||||
#else
|
||||
lmenu.add_option(_("Cancel orders"), false);
|
||||
#endif
|
||||
lmenu.add_option(_("Cancel orders"), false,
|
||||
game_config::small_gui ? gui::dialog::BUTTON_EXTRA : gui::dialog::BUTTON_STANDARD);
|
||||
}
|
||||
lmenu.add_button(new gui::standard_dialog_button(disp.video(),_("OK"),0,false), gui::dialog::BUTTON_STANDARD);
|
||||
lmenu.add_button(new gui::standard_dialog_button(disp.video(),_("Cancel"),1,true), gui::dialog::BUTTON_STANDARD);
|
||||
|
||||
delete_save save_deleter(disp,*filter,games,summaries);
|
||||
gui::dialog_button_info delete_button(&save_deleter,_("Delete Save"));
|
||||
#ifdef USE_SMALL_GUI
|
||||
//placing the buttons in one line so that none is coverd by any of the others
|
||||
lmenu.add_button(delete_button,gui::dialog::BUTTON_HELP);
|
||||
#else
|
||||
lmenu.add_button(delete_button);
|
||||
#endif
|
||||
|
||||
lmenu.add_button(delete_button,
|
||||
game_config::small_gui ? gui::dialog::BUTTON_HELP : gui::dialog::BUTTON_STANDARD);
|
||||
|
||||
int res = lmenu.show();
|
||||
|
||||
|
16
src/game.cpp
16
src/game.cpp
@ -273,6 +273,8 @@ game_controller::game_controller(int argc, char** argv)
|
||||
no_gui_ = true;
|
||||
no_sound = true;
|
||||
preferences::disable_preferences_save();
|
||||
} else if(val == "--smallgui") {
|
||||
game_config::small_gui = true;
|
||||
} else if(val == "--windowed" || val == "-w") {
|
||||
preferences::set_fullscreen(false);
|
||||
} else if(val == "--fullscreen" || val == "-f") {
|
||||
@ -339,6 +341,11 @@ game_controller::game_controller(int argc, char** argv)
|
||||
}
|
||||
std::cerr << "Data at '" << game_config::path << "'\n";
|
||||
|
||||
//TODO: remove this and the configure option
|
||||
#ifdef USE_SMALL_GUI
|
||||
game_config::small_gui = true;
|
||||
#endif
|
||||
|
||||
// disable sound in nosound mode, or when sound engine failed to initialize
|
||||
if (no_sound || ((preferences::sound_on() || preferences::music_on() ||
|
||||
preferences::turn_bell() || preferences::UI_sound_on()) &&
|
||||
@ -439,8 +446,7 @@ bool game_controller::init_video()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SMALL_GUI
|
||||
if(bpp == 0) {
|
||||
if(game_config::small_gui && bpp == 0) {
|
||||
std::cerr << "800x600x" << DefaultBPP << " not available - attempting 800x480x" << DefaultBPP << "...\n";
|
||||
|
||||
resolution.first = 800;
|
||||
@ -448,7 +454,6 @@ bool game_controller::init_video()
|
||||
|
||||
bpp = video_.modePossible(resolution.first,resolution.second,DefaultBPP,video_flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(bpp == 0) {
|
||||
//couldn't do 1024x768 or 800x600
|
||||
@ -2215,9 +2220,8 @@ void game_controller::reset_defines_map()
|
||||
defines_map_["TINY"] = preproc_define();
|
||||
#endif
|
||||
|
||||
#ifdef USE_SMALL_GUI
|
||||
defines_map_["SMALL_GUI"] = preproc_define();
|
||||
#endif
|
||||
if (game_config::small_gui)
|
||||
defines_map_["SMALL_GUI"] = preproc_define();
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
defines_map_["PYTHON"] = preproc_define();
|
||||
|
@ -51,7 +51,7 @@ namespace game_config
|
||||
const std::string revision = VERSION;
|
||||
#endif
|
||||
std::string wesnothd_name;
|
||||
bool debug = false, editor = false, ignore_replay_errors = false, mp_debug = false, exit_at_end = false, no_delay = false, disable_autosave = false;
|
||||
bool debug = false, editor = false, ignore_replay_errors = false, mp_debug = false, exit_at_end = false, no_delay = false, small_gui = false, disable_autosave = false;
|
||||
|
||||
std::string game_icon = "wesnoth-icon.png", game_title, game_logo, title_music, lobby_music;
|
||||
int title_logo_x = 0, title_logo_y = 0, title_buttons_x = 0, title_buttons_y = 0, title_buttons_padding = 0,
|
||||
|
@ -46,7 +46,7 @@ namespace game_config
|
||||
//! starting gold and carryover gold.
|
||||
extern const bool gold_carryover_add;
|
||||
|
||||
extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, no_delay, disable_autosave;
|
||||
extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, no_delay, small_gui, disable_autosave;
|
||||
|
||||
extern std::string path;
|
||||
|
||||
|
@ -117,6 +117,25 @@ void _set_fullscreen(bool ison)
|
||||
prefs["fullscreen"] = (ison ? "true" : "false");
|
||||
}
|
||||
|
||||
int min_allowed_width()
|
||||
{
|
||||
#ifdef USE_TINY_GUI
|
||||
return 320;
|
||||
#endif
|
||||
return 800;
|
||||
}
|
||||
|
||||
int min_allowed_height()
|
||||
{
|
||||
#ifdef USE_TINY_GUI
|
||||
return 240;
|
||||
#endif
|
||||
if (game_config::small_gui)
|
||||
return 480;
|
||||
|
||||
return 600;
|
||||
}
|
||||
|
||||
std::pair<int,int> resolution()
|
||||
{
|
||||
const std::string postfix = fullscreen() ? "resolution" : "windowsize";
|
||||
@ -124,8 +143,8 @@ std::pair<int,int> resolution()
|
||||
const string_map::const_iterator y = prefs.values.find('y' + postfix);
|
||||
if(x != prefs.values.end() && y != prefs.values.end() &&
|
||||
x->second.empty() == false && y->second.empty() == false) {
|
||||
std::pair<int,int> res (maximum(atoi(x->second.c_str()),min_allowed_width),
|
||||
maximum(atoi(y->second.c_str()),min_allowed_height));
|
||||
std::pair<int,int> res (maximum(atoi(x->second.c_str()),min_allowed_width()),
|
||||
maximum(atoi(y->second.c_str()),min_allowed_height()));
|
||||
|
||||
// Make sure resolutions are always divisible by 4
|
||||
//res.first &= ~3;
|
||||
|
@ -28,18 +28,6 @@ class display;
|
||||
#include <utility>
|
||||
#include <set>
|
||||
|
||||
// Only there temporary
|
||||
#ifdef USE_TINY_GUI
|
||||
const int min_allowed_width = 320;
|
||||
const int min_allowed_height = 240;
|
||||
#elif defined USE_SMALL_GUI
|
||||
const int min_allowed_width = 800;
|
||||
const int min_allowed_height = 480;
|
||||
#else
|
||||
const int min_allowed_width = 800;
|
||||
const int min_allowed_height = 600;
|
||||
#endif
|
||||
|
||||
namespace preferences {
|
||||
|
||||
struct base_manager
|
||||
@ -64,6 +52,9 @@ namespace preferences {
|
||||
bool fullscreen();
|
||||
void _set_fullscreen(bool ison);
|
||||
|
||||
int min_allowed_width();
|
||||
int min_allowed_height();
|
||||
|
||||
std::pair<int,int> resolution();
|
||||
void _set_resolution(const std::pair<int,int>& res);
|
||||
|
||||
|
@ -435,7 +435,7 @@ bool show_video_mode_dialog(display& disp)
|
||||
std::vector<std::pair<int,int> > resolutions;
|
||||
|
||||
for(int i = 0; modes[i] != NULL; ++i) {
|
||||
if(modes[i]->w >= min_allowed_width && modes[i]->h >= min_allowed_height) {
|
||||
if(modes[i]->w >= min_allowed_width() && modes[i]->h >= min_allowed_height()) {
|
||||
resolutions.push_back(std::pair<int,int>(modes[i]->w,modes[i]->h));
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ namespace {
|
||||
int disallow_resize = 0;
|
||||
}
|
||||
void resize_monitor::process(events::pump_info &info) {
|
||||
if(info.resize_dimensions.first >= min_allowed_width
|
||||
&& info.resize_dimensions.second >= min_allowed_height
|
||||
if(info.resize_dimensions.first >= preferences::min_allowed_width()
|
||||
&& info.resize_dimensions.second >= preferences::min_allowed_height()
|
||||
&& disallow_resize == 0) {
|
||||
preferences::set_resolution(info.resize_dimensions);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user