projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed game crashing when leaving the worldmap
[supertux.git]
/
src
/
main.cpp
diff --git
a/src/main.cpp
b/src/main.cpp
index
8144ecd
..
20ea613
100644
(file)
--- a/
src/main.cpp
+++ b/
src/main.cpp
@@
-218,8
+218,6
@@
static void init_physfs(const char* argv0)
#else
datadir = APPDATADIR;
#endif
#else
datadir = APPDATADIR;
#endif
- datadir += "/";
- datadir += application;
if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) {
log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
}
if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) {
log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
}
@@
-245,6
+243,7
@@
static void print_usage(const char* argv0)
" -w, --window Run in window mode\n"
" -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n"
" -a, --aspect WIDTH:HEIGHT Run SuperTux with given aspect ratio\n"
" -w, --window Run in window mode\n"
" -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n"
" -a, --aspect WIDTH:HEIGHT Run SuperTux with given aspect ratio\n"
+ " -d, --default Reset video settings to default values\n"
" --disable-sfx Disable sound effects\n"
" --disable-music Disable music\n"
" --help Show this help message\n"
" --disable-sfx Disable sound effects\n"
" --disable-music Disable music\n"
" --help Show this help message\n"
@@
-288,6
+287,11
@@
static bool parse_commandline(int argc, char** argv)
return true;
} else if(arg == "--fullscreen" || arg == "-f") {
config->use_fullscreen = true;
return true;
} else if(arg == "--fullscreen" || arg == "-f") {
config->use_fullscreen = true;
+ } else if(arg == "--default" || arg == "-d") {
+ config->use_fullscreen = false;
+ config->aspect_ratio = -1;
+ config->screenwidth = 800;
+ config->screenheight = 600;
} else if(arg == "--window" || arg == "-w") {
config->use_fullscreen = false;
} else if(arg == "--geometry" || arg == "-g") {
} else if(arg == "--window" || arg == "-w") {
config->use_fullscreen = false;
} else if(arg == "--geometry" || arg == "-g") {
@@
-401,11
+405,18
@@
void init_video()
// try to guess aspect ratio of monitor if needed
if (aspect_ratio <= 0) {
// try to guess aspect ratio of monitor if needed
if (aspect_ratio <= 0) {
+// TODO: commented out because
+// 1) it tends to guess wrong if widescreen-monitors don't stretch 800x600 to fit, but just display black borders
+// 2) aspect ratios other than 4:3 are largely untested
+/*
if(config->use_fullscreen && desktop_width > 0) {
aspect_ratio = static_cast<double>(desktop_width) / static_cast<double>(desktop_height);
} else {
if(config->use_fullscreen && desktop_width > 0) {
aspect_ratio = static_cast<double>(desktop_width) / static_cast<double>(desktop_height);
} else {
+*/
aspect_ratio = 4.0 / 3.0;
aspect_ratio = 4.0 / 3.0;
+/*
}
}
+*/
}
// use aspect ratio to calculate logical resolution
}
// use aspect ratio to calculate logical resolution
@@
-423,15
+434,19
@@
void init_video()
SDL_WM_SetCaption(PACKAGE_NAME " " PACKAGE_VERSION, 0);
// set icon
SDL_WM_SetCaption(PACKAGE_NAME " " PACKAGE_VERSION, 0);
// set icon
- SDL_Surface* icon = IMG_Load_RW(
- get_physfs_SDLRWops("images/engine/icons/supertux.xpm"), true);
+ #ifdef MACOSX
+ const char* icon_fname = "images/engine/icons/supertux-256x256.png";
+ #else
+ const char* icon_fname = "images/engine/icons/supertux.xpm";
+ #endif
+ SDL_Surface* icon = IMG_Load_RW(get_physfs_SDLRWops(icon_fname), true);
if(icon != 0) {
SDL_WM_SetIcon(icon, 0);
SDL_FreeSurface(icon);
}
#ifdef DEBUG
else {
if(icon != 0) {
SDL_WM_SetIcon(icon, 0);
SDL_FreeSurface(icon);
}
#ifdef DEBUG
else {
- log_warning << "Couldn't find icon '
images/engine/icons/supertux.xpm
'" << std::endl;
+ log_warning << "Couldn't find icon '
" << icon_fname << "
'" << std::endl;
}
#endif
}
#endif