From 500ee24e22aae7b457118d152b4480e99969092e Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 27 Feb 2010 21:50:25 -0700 Subject: Make the gui more themeable and distribute two themes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The older gray theme and the new wood theme are available as themes. The gray theme needs some new graphics for hilights. Add a theme option for branding and add path/to/branding/data to the PhysFS search path. Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Chuck Miller --- src/client.cpp | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 9fa61364..a1b7a512 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -249,13 +249,6 @@ Client::Client(const Options &options): "Exiting.", mLocalDataDir.c_str())); } - // Add the local data directory to PhysicsFS search path - resman->addToSearchPath(mLocalDataDir, false); - - // Add the main data directories to our PhysicsFS search path - if (!options.dataPath.empty()) - resman->addToSearchPath(options.dataPath, true); - resman->addToSearchPath("data", true); #if defined __APPLE__ CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); @@ -267,10 +260,40 @@ Client::Client(const Options &options): } CFRelease(resourcesURL); strncat(path, "/data", PATH_MAX - 1); - resman->addToSearchPath(path, true); + resman->addToSearchPath(path, false); + mPackageDir = path; +#else + resman->addToSearchPath(PKG_DATADIR "data", false); + mPackageDir = PKG_DATADIR "data"; +#endif + + resman->addToSearchPath("data", false); + + // Add branding/data to PhysFS search path + if (!options.brandingPath.empty()) + { + std::string path = options.brandingPath; + + // Strip blah.mana from the path +#ifdef WIN32 + int loc1 = path.find_last_of('/'); + int loc2 = path.find_last_of('\\'); + int loc = std::max(loc1, loc2); #else - resman->addToSearchPath(PKG_DATADIR "data", true); + int loc = path.find_last_of('/'); #endif + if (loc > 0) + path = path.substr(0, loc + 1); + + resman->addToSearchPath(path + "data", false); + } + + // Add the main data directories to our PhysicsFS search path + if (!options.dataPath.empty()) + resman->addToSearchPath(options.dataPath, false); + + // Add the local data directory to PhysicsFS search path + resman->addToSearchPath(mLocalDataDir, false); #ifdef WIN32 static SDL_SysWMinfo pInfo; @@ -319,6 +342,8 @@ Client::Client(const Options &options): // Initialize for drawing graphics->_beginDraw(); + SkinLoader::prepareThemePath(); + // Initialize the item shortcuts. itemShortcut = new ItemShortcut; -- cgit v1.2.3-60-g2f50