Revision: 1369 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1369&view=rev Author: rorthomas Date: 2010-05-05 16:00:11 +0000 (Wed, 05 May 2010)
Log Message: ----------- made some windows code UNICODE compile-able added NOLANG mode that does not use RoR's i18n Settings class decoupled a bit -> better usable outside or RoR removed obsolete effects (ASCII and Night vision) Modified Paths: -------------- trunk/source/main/ExampleFrameListener.cpp trunk/source/main/Settings.cpp trunk/source/main/Settings.h trunk/source/main/errorutils.cpp trunk/source/main/language.h Modified: trunk/source/main/ExampleFrameListener.cpp =================================================================== --- trunk/source/main/ExampleFrameListener.cpp 2010-05-04 22:33:23 UTC (rev 1368) +++ trunk/source/main/ExampleFrameListener.cpp 2010-05-05 16:00:11 UTC (rev 1369) @@ -5580,18 +5580,6 @@ CompositorManager::getSingleton().setCompositorEnabled(mCamera->getViewport(), "Gaussian Blur", false); } - // fun stuff :D - if (SETTINGS.getSetting("ASCII") == "Yes") - { - CompositorManager::getSingleton().addCompositor(mCamera->getViewport(),"ASCII"); - CompositorManager::getSingleton().setCompositorEnabled(mCamera->getViewport(), "ASCII", true); - } - if (SETTINGS.getSetting("Night Vision") == "Yes") - { - CompositorManager::getSingleton().addCompositor(mCamera->getViewport(),"Night Vision"); - CompositorManager::getSingleton().setCompositorEnabled(mCamera->getViewport(), "Night Vision", true); - } - // Motion blur stuff :) if (SETTINGS.getSetting("Motion blur")=="Yes") { @@ -5822,7 +5810,6 @@ DustManager::getSingleton().setWater(w); //environment map - //envmap is always created! if (SETTINGS.getSetting("Envmapdisable")!="Yes") { envmap=new Envmap(mSceneMgr, mWindow, mCamera, SETTINGS.getSetting("Envmap")=="Yes"); Modified: trunk/source/main/Settings.cpp =================================================================== --- trunk/source/main/Settings.cpp 2010-05-04 22:33:23 UTC (rev 1368) +++ trunk/source/main/Settings.cpp 2010-05-05 16:00:11 UTC (rev 1369) @@ -135,32 +135,27 @@ checkGUID(); } -bool Settings::setupPaths() +bool Settings::get_system_paths(char *program_path, char *user_path) { - char program_path[1024]=""; - char resources_path[1024]=""; - char streams_path[1024]=""; - char user_path[1024]=""; - char config_root[1024]=""; - char dirsep='/'; #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - if (!GetModuleFileName(NULL, program_path, 512)) + // note: we enforce usage of the non-UNICODE interfaces (since its easier to integrate here) + if (!GetModuleFileNameA(NULL, program_path, 512)) { showError(_L("Startup error"), _L("Error while retrieving program space path")); return false; } - GetShortPathName(program_path, program_path, 512); //this is legal + GetShortPathNameA(program_path, program_path, 512); //this is legal path_descend(program_path); if (getSetting("userpath").empty()) { - if (SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, user_path)!=S_OK) + if (SHGetFolderPathA(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, user_path)!=S_OK) { showError(_L("Startup error"), _L("Error while retrieving user space path")); return false; } - GetShortPathName(user_path, user_path, 512); //this is legal + GetShortPathNameA(user_path, user_path, 512); //this is legal sprintf(user_path, "%s\\Rigs of Rods\\", user_path); } else { @@ -233,6 +228,21 @@ } } #endif + return true; +} + +bool Settings::setupPaths() +{ + char program_path[1024]=""; + char resources_path[1024]=""; + char streams_path[1024]=""; + char user_path[1024]=""; + char config_root[1024]=""; + char dirsep='/'; + + if(get_system_paths(program_path, user_path)) + return false; + //NEXT, derive the resources and stream paths from the base paths (depends on configuration) //from now we are mostly platform neutral //default mode (released) Modified: trunk/source/main/Settings.h =================================================================== --- trunk/source/main/Settings.h 2010-05-04 22:33:23 UTC (rev 1368) +++ trunk/source/main/Settings.h 2010-05-05 16:00:11 UTC (rev 1369) @@ -22,12 +22,11 @@ #define SETTINGS_H #include "Ogre.h" -#include "rormemory.h" #include <map> #define SETTINGS Settings::Instance() -class Settings : public MemoryAllocatedObject +class Settings { public: static Settings & Instance(); @@ -62,5 +61,7 @@ void path_descend(char* path); void path_add(char* path, const char* dirname); + bool get_system_paths(char *program_path, char *user_path); + }; #endif Modified: trunk/source/main/errorutils.cpp =================================================================== --- trunk/source/main/errorutils.cpp 2010-05-04 22:33:23 UTC (rev 1368) +++ trunk/source/main/errorutils.cpp 2010-05-05 16:00:11 UTC (rev 1369) @@ -49,7 +49,7 @@ #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 int mtype = MB_ICONERROR; if(type == 1) mtype = MB_ICONINFORMATION; - MessageBox( NULL, err.c_str(), title.c_str(), MB_OK | mtype | MB_TOPMOST); + MessageBoxA( NULL, err.c_str(), title.c_str(), MB_OK | mtype | MB_TOPMOST); #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX printf("\n\n%s: %s\n\n", title.c_str(), err.c_str()); #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE @@ -67,7 +67,7 @@ #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 Ogre::String additional = _L("\n\nYou can eventually get help here:\n\n") + url + _L("\n\nDo you want to open that address in your default browser now?"); err += additional; - int Response = MessageBox( NULL, err.c_str(), title.c_str(), MB_YESNO | MB_ICONERROR | MB_TOPMOST); + int Response = MessageBoxA( NULL, err.c_str(), title.c_str(), MB_YESNO | MB_ICONERROR | MB_TOPMOST); // 6 = yes, 7 = no if(Response == 6) { Modified: trunk/source/main/language.h =================================================================== --- trunk/source/main/language.h 2010-05-04 22:33:23 UTC (rev 1368) +++ trunk/source/main/language.h 2010-05-05 16:00:11 UTC (rev 1369) @@ -25,6 +25,14 @@ #ifndef LANGUAGE_H_ #define LANGUAGE_H_ +#ifdef NOLANG +// no language mode +// used when building with wxwidgets for example (as they ship their own i18n) + +#define _L(str) str + +#else // NOLANG + #include "Ogre.h" #ifdef USE_MOFILEREADER #include "moFileReader.h" @@ -53,4 +61,5 @@ #endif // MOFILEREADER void setupCodeRanges(Ogre::String codeRangesFilename, Ogre::String codeRangesGroupname); }; -#endif +#endif //NOLANG +#endif //LANGUAGE_H_ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel