Wesnoth now stores two resolutions:

one for fullscreen and one for windowed mode. When you switch to/from
fullscreen mode, it sets your resolution appropriately. The old
xresolution= and yresoltion= tags from ~/.wesnoth/preferences are
ignored, so this requires a one time setting-up of resolutions.
This commit is contained in:
John B. Messerly 2004-05-08 19:39:43 +00:00
parent 3454f98027
commit 0ccfa64a7d

View file

@ -111,8 +111,9 @@ void set_fullscreen(bool ison)
std::pair<int,int> resolution() std::pair<int,int> resolution()
{ {
const string_map::const_iterator x = prefs.values.find("xresolution"); const std::string prefix = fullscreen() ? "fullscreen_" : "windowed_";
const string_map::const_iterator y = prefs.values.find("yresolution"); const string_map::const_iterator x = prefs.values.find(prefix + "xres");
const string_map::const_iterator y = prefs.values.find(prefix + "yres");
if(x != prefs.values.end() && y != prefs.values.end() && if(x != prefs.values.end() && y != prefs.values.end() &&
x->second.empty() == false && y->second.empty() == false) { x->second.empty() == false && y->second.empty() == false) {
std::pair<int,int> res (maximum(atoi(x->second.c_str()),800), std::pair<int,int> res (maximum(atoi(x->second.c_str()),800),
@ -152,11 +153,9 @@ void set_resolution(const std::pair<int,int>& resolution)
} }
if(write_resolution) { if(write_resolution) {
char buf[50]; const std::string prefix = fullscreen() ? "fullscreen_" : "windowed_";
sprintf(buf,"%d",res.first); prefs[prefix + "xres"] = lexical_cast<std::string>(res.first);
prefs["xresolution"] = buf; prefs[prefix + "yres"] = lexical_cast<std::string>(res.second);
sprintf(buf,"%d",res.second);
prefs["yresolution"] = buf;
} }
} }