X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmain.cpp;h=08d3d86feab69adcd95695af19337e4c4cbf1673;hb=4967684276df2b7fe4c948451edd49e558328dca;hp=2148861eb09228c317f8dc00fe00063e1c5170ff;hpb=febe2b19a818aa8bf7e6534313281bf2ccd00ffe;p=supertux.git diff --git a/src/main.cpp b/src/main.cpp index 2148861eb..08d3d86fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,7 +35,9 @@ #include #ifdef MACOSX -# include +namespace supertux_apple { +#include +} #endif #include "gameconfig.hpp" @@ -168,13 +170,16 @@ static void init_physfs(const char* argv0) } #ifdef MACOSX +{ + using namespace supertux_apple; + // when started from Application file on Mac OS X... char path[PATH_MAX]; CFBundleRef mainBundle = CFBundleGetMainBundle(); assert(mainBundle != 0); CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); assert(mainBundleURL != 0); - CFStringRef pathStr = CFUrlCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); + CFStringRef pathStr = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); assert(pathStr != 0); CFStringGetCString(pathStr, path, PATH_MAX, kCFStringEncodingUTF8); CFRelease(mainBundleURL); @@ -192,6 +197,7 @@ static void init_physfs(const char* argv0) sourcedir = true; } } +} #endif #ifdef _WIN32 @@ -212,8 +218,6 @@ static void init_physfs(const char* argv0) #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; } @@ -395,11 +399,18 @@ void init_video() // 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(desktop_width) / static_cast(desktop_height); } else { +*/ aspect_ratio = 4.0 / 3.0; +/* } +*/ } // use aspect ratio to calculate logical resolution @@ -417,15 +428,19 @@ void init_video() 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 { - log_warning << "Couldn't find icon 'images/engine/icons/supertux.xpm'" << std::endl; + log_warning << "Couldn't find icon '" << icon_fname << "'" << std::endl; } #endif