Changeset 8351 for code/trunk/src/libraries/core
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (14 years ago)
- Location:
- code/trunk/src/libraries/core
- Files:
-
- 2 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/CMakeLists.txt
r8079 r8351 58 58 command/ArgumentCompletionFunctions.cc 59 59 ConfigFileManager.cc 60 MemoryArchive.cc61 60 PathConfig.cc 62 61 COMPILATION_END … … 98 97 ${CEGUI_LIBRARY} 99 98 ${CEGUILUA_LIBRARY} 100 ${LUA_LIBRARIES} 99 ${CEGUI_TOLUA_LIBRARY} 100 ${CEGUI_OGRE_RENDERER_LIBRARY} 101 ${LUA5.1_LIBRARY} 101 102 cpptcl_orxonox 102 ogreceguirenderer_orxonox103 103 ois_orxonox 104 104 tinyxml_orxonox 105 tolua_orxonox106 105 util 106 LINK_LIBS_UNIX 107 dl 108 pthread 107 109 SOURCE_FILES 108 110 ${CORE_SRC_FILES} -
code/trunk/src/libraries/core/ConfigValueContainer.cc
r7284 r8351 158 158 { 159 159 return this->callFunctionWithIndex(&ConfigValueContainer::tset, input); 160 return false;161 160 } 162 161 else -
code/trunk/src/libraries/core/Core.cc
r8079 r8351 81 81 82 82 SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file"); 83 #if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN) 83 84 SetCommandLineSwitch(noIOConsole).information("Use this if you don't want to use the IOConsole (for instance for Lua debugging)"); 85 #endif 84 86 85 87 #ifdef ORXONOX_PLATFORM_WINDOWS … … 156 158 this->setConfigValues(); 157 159 158 // create persistent io console 160 #if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN) 161 // Create persistent IO console 159 162 if (CommandLineParser::getValue("noIOConsole").getBool()) 160 163 { … … 163 166 if (this->bStartIOConsole_) 164 167 this->ioConsole_.reset(new IOConsole()); 168 #endif 165 169 166 170 // creates the class hierarchy for all classes with factories -
code/trunk/src/libraries/core/CorePrereqs.h
r8079 r8351 38 38 #include "OrxonoxConfig.h" 39 39 #include <boost/version.hpp> 40 #include <CEGUIVersion.h> 40 41 41 42 //----------------------------------------------------------------------- … … 53 54 # endif 54 55 # endif 55 #elif defined ( ORXONOX_GCC_VISIBILITY ) 56 # define _CorePrivate 57 #elif defined (ORXONOX_GCC_VISIBILITY) 56 58 # define _CoreExport __attribute__ ((visibility("default"))) 59 # define _CorePrivate __attribute__ ((visibility("hidden"))) 57 60 #else 58 61 # define _CoreExport 62 # define _CorePrivate 59 63 #endif 60 64 … … 259 263 { 260 264 #if (BOOST_VERSION < 104400) 265 261 266 namespace filesystem 262 267 { … … 265 270 typedef basic_path<std::string, path_traits> path; 266 271 } 267 #else 272 273 #elif (BOOST_VERSION < 104800) 274 275 # if BOOST_FILESYSTEM_VERSION == 2 268 276 namespace filesystem2 269 277 { … … 278 286 using filesystem2::path; 279 287 } 288 # elif BOOST_FILESYSTEM_VERSION == 3 289 namespace filesystem3 290 { 291 class path; 292 } 293 namespace filesystem 294 { 295 using filesystem3::path; 296 } 297 # endif 298 299 #else 300 301 // TODO: Check this once boost 1.48 is released 302 namespace filesystem 303 { 304 class path; 305 } 306 280 307 #endif 308 281 309 class thread; 282 310 class mutex; … … 306 334 class LuaScriptModule; 307 335 336 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 308 337 class OgreCEGUIRenderer; 309 338 class OgreCEGUIResourceProvider; 310 339 class OgreCEGUITexture; 340 #else 341 class OgreRenderer; 342 class OgreResourceProvider; 343 class OgreImageCodec; 344 #endif 311 345 } 312 346 -
code/trunk/src/libraries/core/DynLib.cc
r6417 r8351 42 42 #endif 43 43 44 #ifdef ORXONOX_PLATFORM_ LINUX44 #ifdef ORXONOX_PLATFORM_UNIX 45 45 # include <dlfcn.h> 46 46 #endif 47 47 48 48 #ifdef ORXONOX_PLATFORM_APPLE 49 # include <macPlugins.h>49 # include <OSX/macUtils.h> // OGRE include 50 50 #endif 51 51 … … 75 75 if (name.substr(name.length() - 3, 3) != ".so") 76 76 name += ".so"; 77 #elif defined(ORXONOX_PLATFORM_APPLE) 78 // dlopen() does not add .dylib to the filename, like windows does for .dll 79 if (name.substr(name.length() - 6, 6) != ".dylib") 80 name += ".dylib"; 81 #elif defined(ORXONOX_PLATFORM_WINDOWS) 82 // Although LoadLibraryEx will add .dll itself when you only specify the library name, 83 // if you include a relative path then it does not. So, add it to be sure. 84 if (name.substr(name.length() - 4, 4) != ".dll") 85 name += ".dll"; 77 86 #endif 78 87 … … 127 136 LocalFree( lpMsgBuf ); 128 137 return ret; 129 #elif defined(ORXONOX_PLATFORM_ LINUX)138 #elif defined(ORXONOX_PLATFORM_UNIX) 130 139 return std::string(dlerror()); 131 #elif defined(ORXONOX_PLATFORM_APPLE)132 return std::string(mac_errorBundle());133 140 #else 134 141 return ""; 135 142 #endif 136 143 } 137 138 144 } -
code/trunk/src/libraries/core/DynLib.h
r7401 r8351 52 52 typedef struct HINSTANCE__* hInstance; 53 53 54 #elif defined(ORXONOX_PLATFORM_ LINUX)54 #elif defined(ORXONOX_PLATFORM_UNIX) 55 55 # define DYNLIB_HANDLE void* 56 56 # define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL) 57 57 # define DYNLIB_GETSYM( a, b ) dlsym( a, b ) 58 58 # define DYNLIB_UNLOAD( a ) dlclose( a ) 59 60 #elif defined(ORXONOX_PLATFORM_APPLE)61 # define DYNLIB_HANDLE CFBundleRef62 # define DYNLIB_LOAD( a ) mac_loadExeBundle( a )63 # define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )64 # define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )65 59 #endif 66 60 -
code/trunk/src/libraries/core/GUIManager.cc
r8079 r8351 30 30 #include "GUIManager.h" 31 31 32 #include <memory> 32 33 #include <boost/bind.hpp> 33 #include <memory> 34 #include <OgreRenderQueue.h> 35 #include <OgreRenderWindow.h> 34 36 35 37 #include <CEGUIDefaultLogger.h> … … 43 45 #include <elements/CEGUIListbox.h> 44 46 #include <elements/CEGUIListboxItem.h> 45 #include <ogreceguirenderer/OgreCEGUIRenderer.h> 46 47 #include "SpecialConfig.h" // Configures the macro below 48 #ifdef CEGUILUA_USE_INTERNAL_LIBRARY 49 # include <ceguilua/CEGUILua.h> 50 #else 51 # include <CEGUILua.h> 47 48 #ifdef ORXONOX_OLD_CEGUI 49 # include <CEGUILua.h> 50 # include <ogreceguirenderer/OgreCEGUIRenderer.h> 51 extern "C" { 52 # include <lauxlib.h> 53 } 54 #else 55 # include <ScriptingModules/LuaScriptModule/CEGUILua.h> 56 # include <RendererModules/Ogre/CEGUIOgreImageCodec.h> 57 # include <RendererModules/Ogre/CEGUIOgreRenderer.h> 58 # include <RendererModules/Ogre/CEGUIOgreResourceProvider.h> 59 # include <OgreCamera.h> 60 # include <OgreRenderQueueListener.h> 61 # include <OgreSceneManager.h> 52 62 #endif 53 63 … … 89 99 case CEGUI::Informative: orxonoxLevel = 5; break; 90 100 case CEGUI::Insane: orxonoxLevel = 6; break; 91 default: OrxAssert(false, "CEGUI log level out of range, in pect immediately!");101 default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!"); 92 102 } 93 103 OutputHandler::getOutStream(orxonoxLevel) … … 97 107 } 98 108 }; 109 110 #ifdef ORXONOX_OLD_CEGUI 111 /** Class with the same memory layout as CEGUI::LuaScriptModule. <br> 112 We need this to fix a problem with an uninitialised member variable 113 in CEGUI < 0.7 <br> 114 Notice the "public" modifier for the otherwise private variables. 115 */ 116 class LuaScriptModuleWorkaround : public CEGUI::ScriptModule 117 { 118 public: 119 LuaScriptModuleWorkaround(); 120 ~LuaScriptModuleWorkaround(); 121 122 public: 123 bool d_ownsState; 124 lua_State* d_state; 125 CEGUI::String d_errFuncName; 126 int d_errFuncIndex; 127 CEGUI::String d_activeErrFuncName; 128 int d_activeErrFuncIndex; 129 }; 130 #else 131 /// RenderQueueListener based class used to hook into the ogre rendering system 132 class RQListener : public Ogre::RenderQueueListener 133 { 134 public: 135 /// Callback from Ogre invoked before other stuff in our target queue is rendered 136 void renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue) 137 { 138 if (id == Ogre::RENDER_QUEUE_SKIES_LATE)//Ogre::RENDER_QUEUE_OVERLAY) 139 CEGUI::System::getSingleton().renderGUI(); 140 } 141 }; 142 #endif 99 143 100 144 static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button); … … 118 162 */ 119 163 GUIManager::GUIManager(const std::pair<int, int>& mousePosition) 120 : resourceProvider_(NULL) 164 : destroyer_(*this, &GUIManager::cleanup) 165 , guiRenderer_(NULL) 166 , resourceProvider_(NULL) 167 #ifndef ORXONOX_OLD_CEGUI 168 , imageCodec_(NULL) 169 #endif 170 , luaState_(NULL) 171 , scriptModule_(NULL) 172 , guiSystem_(NULL) 121 173 , camera_(NULL) 122 174 { … … 129 181 130 182 // Note: No SceneManager specified yet 131 guiRenderer_.reset(new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000)); 183 #ifdef ORXONOX_OLD_CEGUI 184 guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000); 132 185 resourceProvider_ = guiRenderer_->createResourceProvider(); 186 #else 187 guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow()); 188 // We use our own RenderQueueListener so we can draw UNDER overlays 189 guiRenderer_->setFrameControlExecutionEnabled(false); 190 rqListener_ = new RQListener(); 191 resourceProvider_ = &OgreRenderer::createOgreResourceProvider(); 192 imageCodec_ = &OgreRenderer::createOgreImageCodec(); 193 #endif 133 194 resourceProvider_->setDefaultResourceGroup("General"); 134 195 135 196 // Setup scripting 136 luaState_ .reset(new LuaState());197 luaState_ = new LuaState(); 137 198 rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua"); 138 199 // This is necessary to ensure that input events also use the right resource info when triggering lua functions 139 200 luaState_->setDefaultResourceInfo(this->rootFileInfo_); 140 scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState())); 201 #ifdef ORXONOX_OLD_CEGUI 202 scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState()); 203 // Ugly workaround: older CEGUILua versions don't initialise the member 204 // d_activeErrFuncIndex at all. That leads to "error in error handling" 205 // problems when a Lua error occurs. 206 // We fix this by setting the member manually. 207 reinterpret_cast<LuaScriptModuleWorkaround*>(scriptModule_)->d_activeErrFuncIndex = LUA_NOREF; 208 luaState_->doString("ORXONOX_OLD_CEGUI = true"); 209 #else 210 scriptModule_ = &LuaScriptModule::create(luaState_->getInternalLuaState()); 211 #endif 141 212 scriptModule_->setDefaultPCallErrorHandler(LuaState::ERROR_HANDLER_NAME); 142 213 … … 144 215 std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger()); 145 216 ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log"); 146 // set the log level according to ours (translate by subtracting 1)217 // Set the log level according to ours (translate by subtracting 1) 147 218 ceguiLogger->setLoggingLevel( 148 219 static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1)); … … 150 221 151 222 // Create the CEGUI system singleton 152 guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get())); 223 #ifdef ORXONOX_OLD_CEGUI 224 guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_); 225 // Add functions that have been renamed in newer versions 226 luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme"); 227 luaState_->doString("CEGUI.Window.getUnclippedOuterRect = CEGUI.Window.getUnclippedPixelRect"); 228 #else 229 guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_); 230 #endif 153 231 154 232 // Align CEGUI mouse with OIS mouse … … 175 253 } 176 254 177 /** 178 @brief 179 Basically shuts down CEGUI (member smart pointers) but first unloads our Tolua modules. 180 */ 181 GUIManager::~GUIManager() 182 { 255 void GUIManager::cleanup() 256 { 257 using namespace CEGUI; 258 259 #ifdef ORXONOX_OLD_CEGUI 260 delete guiSystem_; 261 delete guiRenderer_; 262 delete scriptModule_; 263 #else 264 System::destroy(); 265 OgreRenderer::destroyOgreResourceProvider(*resourceProvider_); 266 OgreRenderer::destroyOgreImageCodec(*imageCodec_); 267 OgreRenderer::destroy(*guiRenderer_); 268 LuaScriptModule::destroy(*scriptModule_); 269 delete ceguiLogger_; 270 delete rqListener_; 271 #endif 272 delete luaState_; 183 273 } 184 274 … … 221 311 void GUIManager::setCamera(Ogre::Camera* camera) 222 312 { 223 this->camera_ = camera; 313 #ifdef ORXONOX_OLD_CEGUI 224 314 if (camera == NULL) 225 315 this->guiRenderer_->setTargetSceneManager(0); 226 316 else 227 317 this->guiRenderer_->setTargetSceneManager(camera->getSceneManager()); 318 #else 319 if (camera_ != NULL && camera_->getSceneManager() != NULL) 320 camera_->getSceneManager()->removeRenderQueueListener(rqListener_); 321 if (camera != NULL && camera->getSceneManager() != NULL) 322 camera->getSceneManager()->addRenderQueueListener(rqListener_); 323 #endif 324 this->camera_ = camera; 228 325 } 229 326 … … 321 418 false | False | True | Dontcare 322 419 */ 420 421 #ifdef ORXONOX_PLATFORM_APPLE 422 // There is no non exclusive mode on OS X yet 423 state->setMouseExclusive(TriBool::True); 424 #else 323 425 if (showCursor == TriBool::Dontcare) 324 426 state->setMouseExclusive(TriBool::Dontcare); … … 327 429 else 328 430 state->setMouseExclusive(TriBool::False); 431 #endif 329 432 330 433 if (showCursor == TriBool::True) … … 522 625 The Listbox for which to enable (or disable) tooltips. 523 626 @param enabled 524 Whether to enable or disab elthe tooltips.627 Whether to enable or disable the tooltips. 525 628 */ 526 629 void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled) -
code/trunk/src/libraries/core/GUIManager.h
r8079 r8351 42 42 #include <string> 43 43 #include <CEGUIForwardRefs.h> 44 #include < boost/scoped_ptr.hpp>44 #include <CEGUIVersion.h> 45 45 #include <boost/shared_ptr.hpp> 46 #include <loki/ScopeGuard.h> 46 47 47 48 #include "util/OgreForwardRefs.h" … … 57 58 $cfile "../util/TriBool.h" // tolua_export 58 59 */ 60 61 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 62 # define ORXONOX_OLD_CEGUI 63 #endif 59 64 60 65 namespace orxonox // tolua_export … … 78 83 public: 79 84 GUIManager(const std::pair<int, int>& mousePosition); 80 ~GUIManager(); 85 //! Leave empty and use cleanup() instead 86 ~GUIManager() {} 81 87 82 88 void setConfigValues(void); … … 104 110 const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export 105 111 LuaState* getLuaState(void) 106 { return this->luaState_ .get(); }112 { return this->luaState_; } 107 113 108 114 //! Returns the root window for all menu sheets … … 127 133 private: 128 134 GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class) 135 136 /// Destructor that also executes when object fails to construct 137 void cleanup(); 138 129 139 void executeCode(const std::string& str); 130 140 … … 147 157 virtual void windowFocusChanged(bool bFocus); 148 158 149 scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_; //!< CEGUI's interface to the Ogre Engine 150 scoped_ptr<LuaState> luaState_; //!< LuaState, access point to the Lua engine 151 scoped_ptr<CEGUI::LuaScriptModule> scriptModule_; //!< CEGUI's script module to use Lua 152 scoped_ptr<CEGUI::System> guiSystem_; //!< CEGUI's main system 159 /// Surrogate for the destructor 160 Loki::ObjScopeGuardImpl0<GUIManager, void (GUIManager::*)()> destroyer_; 161 162 #ifdef ORXONOX_OLD_CEGUI 163 CEGUI::OgreCEGUIRenderer* guiRenderer_; //!< CEGUI's interface to the Ogre Engine 164 CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider 165 #else 166 CEGUI::OgreRenderer* guiRenderer_; //!< CEGUI's interface to the Ogre Engine 167 Ogre::RenderQueueListener* rqListener_; //!< RQ listener so we can draw UNDER Ogre overlays 168 CEGUI::OgreResourceProvider* resourceProvider_; //!< CEGUI's resource provider 169 CEGUI::OgreImageCodec* imageCodec_; 170 #endif 171 LuaState* luaState_; //!< LuaState, access point to the Lua engine 172 CEGUI::LuaScriptModule* scriptModule_; //!< CEGUI's script module to use Lua 173 CEGUI::System* guiSystem_; //!< CEGUI's main system 153 174 shared_ptr<ResourceInfo> rootFileInfo_; //!< Resource information about the root script 154 CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider155 175 CEGUI::Logger* ceguiLogger_; //!< CEGUI's logger to be able to log CEGUI errors in our log 156 176 CEGUI::Window* rootWindow_; //!< Root node for all windows -
code/trunk/src/libraries/core/Game.cc
r8245 r8351 459 459 ThrowException(GameState, "Emtpy GameState hierarchy provided, terminating."); 460 460 // Add element with large identation to detect the last with just an iterator 461 stateStrings.push_back(std::make_pair( "", -1));461 stateStrings.push_back(std::make_pair(std::string(), -1)); 462 462 463 463 // Parse elements recursively -
code/trunk/src/libraries/core/GraphicsManager.cc
r8079 r8351 30 30 #include "GraphicsManager.h" 31 31 32 #include <cstdlib> 32 33 #include <fstream> 33 34 #include <sstream> … … 35 36 #include <boost/shared_array.hpp> 36 37 37 #include <OgreArchiveFactory.h>38 #include <OgreArchiveManager.h>39 38 #include <OgreFrameListener.h> 40 39 #include <OgreRoot.h> … … 60 59 #include "GUIManager.h" 61 60 #include "Loader.h" 62 #include "MemoryArchive.h"63 61 #include "PathConfig.h" 64 62 #include "ViewportEventListener.h" … … 102 100 GraphicsManager::GraphicsManager(bool bLoadRenderer) 103 101 : ogreWindowEventListener_(new OgreWindowEventListener()) 104 #if OGRE_VERSION < 0x010600105 , memoryArchiveFactory_(new MemoryArchiveFactory())106 #endif107 102 , renderWindow_(0) 108 103 , viewport_(0) … … 126 121 // Only for development runs 127 122 if (PathConfig::isDevelopmentRun()) 128 {129 123 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getExternalDataPathString(), "FileSystem"); 130 extResources_.reset(new XMLFile("resources.oxr")); 131 extResources_->setLuaSupport(false);132 Loader::open(extResources_.get());133 }124 125 extResources_.reset(new XMLFile("resources.oxr")); 126 extResources_->setLuaSupport(false); 127 Loader::open(extResources_.get()); 134 128 135 129 if (bLoadRenderer) … … 156 150 // Undeclare the resources 157 151 Loader::unload(resources_.get()); 158 if (PathConfig::isDevelopmentRun()) 159 Loader::unload(extResources_.get()); 152 Loader::unload(extResources_.get()); 160 153 } 161 154 … … 164 157 SetConfigValue(ogreConfigFile_, "ogre.cfg") 165 158 .description("Location of the Ogre config file"); 166 SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory)167 .description("Folder where the Ogre plugins are located.");168 159 SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins) 169 160 .description("Comma separated list of all plugins to load."); … … 196 187 this->loadRenderer(); 197 188 198 #if OGRE_VERSION < 0x010600199 // WORKAROUND: There is an incompatibility for particle scripts when trying200 // to support both Ogre 1.4 and 1.6. The hacky solution is to create201 // scripts for the 1.6 version and then remove the inserted "particle_system"202 // keyword. But we need to supply these new scripts as well, which is why203 // there is an extra Ogre::Archive dealing with it in the memory.204 using namespace Ogre;205 ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get());206 const StringVector& groups = ResourceGroupManager::getSingleton().getResourceGroups();207 // Travers all groups208 for (StringVector::const_iterator itGroup = groups.begin(); itGroup != groups.end(); ++itGroup)209 {210 FileInfoListPtr files = ResourceGroupManager::getSingleton().findResourceFileInfo(*itGroup, "*.particle");211 for (FileInfoList::const_iterator itFile = files->begin(); itFile != files->end(); ++itFile)212 {213 // open file214 Ogre::DataStreamPtr input = ResourceGroupManager::getSingleton().openResource(itFile->filename, *itGroup, false);215 std::stringstream output;216 // Parse file and replace "particle_system" with nothing217 while (!input->eof())218 {219 std::string line = input->getLine();220 size_t pos = line.find("particle_system");221 if (pos != std::string::npos)222 {223 // 15 is the length of "particle_system"224 line.replace(pos, 15, "");225 }226 output << line << std::endl;227 }228 // Add file to the memory archive229 shared_array<char> data(new char[output.str().size()]);230 // Debug optimisations231 const std::string& outputStr = output.str();232 char* rawData = data.get();233 for (unsigned i = 0; i < outputStr.size(); ++i)234 rawData[i] = outputStr[i];235 MemoryArchive::addFile("particle_scripts_ogre_1.4_" + *itGroup, itFile->filename, data, output.str().size());236 }237 if (!files->empty())238 {239 // Declare the files, but using a new group240 ResourceGroupManager::getSingleton().addResourceLocation("particle_scripts_ogre_1.4_" + *itGroup,241 "Memory", "particle_scripts_ogre_1.4_" + *itGroup);242 }243 }244 #endif245 246 189 // Initialise all resources (do this AFTER the renderer has been loaded!) 247 190 // Note: You can only do this once! Ogre will check whether a resource group has … … 305 248 void GraphicsManager::loadOgrePlugins() 306 249 { 307 // just to make sure the next statement doesn't segfault 308 if (ogrePluginsDirectory_.empty()) 309 ogrePluginsDirectory_ = '.'; 310 311 boost::filesystem::path folder(ogrePluginsDirectory_); 250 // Plugin path can have many different locations... 251 std::string pluginPath = specialConfig::ogrePluginsDirectory; 252 #ifdef DEPENDENCY_PACKAGE_ENABLE 253 if (!PathConfig::isDevelopmentRun()) 254 { 255 # if defined(ORXONOX_PLATFORM_WINDOWS) 256 pluginPath = PathConfig::getExecutablePathString(); 257 # elif defined(ORXONOX_PLATFORM_APPLE) 258 // TODO: Where are the plugins being installed to? 259 pluginPath = PathConfig::getExecutablePathString(); 260 # endif 261 } 262 #endif 263 264 #ifdef ORXONOX_PLATFORM_WINDOWS 265 // Add OGRE plugin path to the environment. That way one plugin could 266 // also depend on another without problems on Windows 267 const char* currentPATH = getenv("PATH"); 268 std::string newPATH = pluginPath; 269 if (currentPATH != NULL) 270 newPATH = std::string(currentPATH) + ';' + newPATH; 271 putenv(const_cast<char*>(("PATH=" + newPATH).c_str())); 272 #endif 273 312 274 // Do some SubString magic to get the comma separated list of plugins 313 275 SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0'); 314 // Use backslash paths on Windows! file_string() already does that though.315 276 for (unsigned int i = 0; i < plugins.size(); ++i) 316 ogreRoot_->loadPlugin( (folder / plugins[i]).file_string());277 ogreRoot_->loadPlugin(pluginPath + '/' + plugins[i]); 317 278 } 318 279 -
code/trunk/src/libraries/core/GraphicsManager.h
r8079 r8351 114 114 115 115 scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h 116 #if OGRE_VERSION < 0x010600117 scoped_ptr<MemoryArchiveFactory> memoryArchiveFactory_; //!< Stores the modified particle scripts118 #endif119 116 scoped_ptr<Ogre::LogManager> ogreLogger_; 120 117 scoped_ptr<Ogre::Root> ogreRoot_; //!< Ogre's root … … 131 128 // config values 132 129 std::string ogreConfigFile_; //!< ogre config filename 133 std::string ogrePluginsDirectory_; //!< Directory where the Ogre plugins are located134 130 std::string ogrePlugins_; //!< Comma separated list of all plugins to load 135 131 std::string ogreLogFile_; //!< log filename for Ogre log messages -
code/trunk/src/libraries/core/Identifier.h
r7401 r8351 123 123 124 124 /// Returns the unique ID of the class. 125 FORCEINLINE unsigned int getClassID() const { return this->classID_; }125 ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; } 126 126 127 127 /// Returns the list of all existing objects of this class. … … 395 395 { 396 396 // Get the name of the class 397 const std::string&name = typeid(T).name();397 std::string name = typeid(T).name(); 398 398 399 399 // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used. … … 486 486 */ 487 487 template <class T, class U> 488 FORCEINLINE T orxonox_cast(U* source)488 ORX_FORCEINLINE T orxonox_cast(U* source) 489 489 { 490 490 #ifdef ORXONOX_COMPILER_MSVC -
code/trunk/src/libraries/core/LuaState.cc
r7284 r8351 30 30 #include "LuaState.h" 31 31 32 #include <tolua /tolua++.h>32 #include <tolua++.h> 33 33 extern "C" { 34 34 #include <lua.h> … … 60 60 luaState_ = lua_open(); 61 61 Loki::ScopeGuard luaStateGuard = Loki::MakeGuard(&lua_close, luaState_); 62 #if LUA_VERSION_NUM == 50163 62 luaL_openlibs(luaState_); 64 #else65 luaopen_base(luaState_);66 luaopen_string(luaState_);67 luaopen_table(luaState_);68 luaopen_math(luaState_);69 luaopen_io(luaState_);70 luaopen_debug(luaState_);71 #endif72 63 73 64 // Open all available tolua interfaces … … 187 178 } 188 179 189 #if LUA_VERSION_NUM != 501190 LoadS ls;191 ls.s = code.c_str();192 ls.size = code.size();193 int error = lua_load(luaState_, &orxonox::LuaState::lua_Chunkreader, &ls, chunkname.c_str());194 #else195 180 int error = luaL_loadbuffer(luaState_, code.c_str(), code.size(), chunkname.c_str()); 196 #endif197 181 198 182 switch (error) … … 293 277 } 294 278 295 #if LUA_VERSION_NUM != 501296 const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)297 {298 LoadS* ls = static_cast<LoadS*>(data);299 if (ls->size == 0)300 return NULL;301 *size = ls->size;302 ls->size = 0;303 return ls->s;304 }305 #endif306 307 279 /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name) 308 280 { -
code/trunk/src/libraries/core/LuaState.h
r7401 r8351 113 113 shared_ptr<ResourceInfo> getFileInfo(const std::string& filename); 114 114 115 #if LUA_VERSION_NUM != 501116 struct LoadS117 {118 const char* s;119 size_t size;120 };121 122 static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);123 #endif124 125 115 std::stringstream output_; 126 116 lua_State* luaState_; -
code/trunk/src/libraries/core/OrxonoxClass.h
r8079 r8351 135 135 Returns NULL if the no pointer was found. 136 136 */ 137 FORCEINLINE void* getDerivedPointer(unsigned int classID)137 ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID) 138 138 { 139 139 for (int i = this->objectPointers_.size() - 1; i >= 0; --i) … … 146 146 147 147 /// Version of getDerivedPointer with template 148 template <class T> FORCEINLINE T* getDerivedPointer(unsigned int classID)148 template <class T> ORX_FORCEINLINE T* getDerivedPointer(unsigned int classID) 149 149 { return static_cast<T*>(this->getDerivedPointer(classID)); } 150 150 /// Const version of getDerivedPointer with template 151 template <class T> FORCEINLINE const T* getDerivedPointer(unsigned int classID) const151 template <class T> ORX_FORCEINLINE const T* getDerivedPointer(unsigned int classID) const 152 152 { return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); } 153 153 -
code/trunk/src/libraries/core/PathConfig.cc
r6417 r8351 33 33 #include <cstdio> 34 34 #include <vector> 35 #include <boost/version.hpp>36 35 #include <boost/filesystem.hpp> 37 36 … … 56 55 #include "CommandLineParser.h" 57 56 58 // Boost 1.36 has some issues with deprecated functions that have been omitted 59 #if (BOOST_VERSION == 103600) 60 # define BOOST_LEAF_FUNCTION filename 57 // Differentiate Boost Filesystem v2 and v3 58 #if (BOOST_FILESYSTEM_VERSION < 3) 59 # define BF_LEAF leaf 60 # define BF_GENERIC_STRING string 61 # define BF_NATIVE_STRING file_string 61 62 #else 62 # define BOOST_LEAF_FUNCTION leaf 63 # define BF_LEAF path().filename().string 64 # define BF_GENERIC_STRING generic_string 65 # define BF_NATIVE_STRING string 63 66 #endif 64 67 … … 95 98 #elif defined(ORXONOX_PLATFORM_APPLE) 96 99 char buffer[1024]; 97 u nsigned longpath_len = 1023;100 uint32_t path_len = 1023; 98 101 if (_NSGetExecutablePath(buffer, &path_len)) 99 102 ThrowException(General, "Could not retrieve executable path."); … … 125 128 #endif 126 129 127 executablePath_ = bf::path(buffer); 128 #ifndef ORXONOX_PLATFORM_APPLE 129 executablePath_ = executablePath_.branch_path(); // remove executable name 130 #endif 130 // Remove executable filename 131 executablePath_ = bf::path(buffer).branch_path(); 131 132 132 133 ///////////////////// … … 206 207 207 208 // Get user directory 208 # ifdef ORXONOX_PLATFORM_UNIX /* Apple? */209 #ifdef ORXONOX_PLATFORM_UNIX 209 210 char* userDataPathPtr(getenv("HOME")); 210 # 211 #else 211 212 char* userDataPathPtr(getenv("APPDATA")); 212 # 213 #endif 213 214 if (userDataPathPtr == NULL) 214 215 ThrowException(General, "Could not retrieve user data path."); … … 233 234 // Create directories to avoid problems when opening files in non existent folders. 234 235 std::vector<std::pair<bf::path, std::string> > directories; 235 directories.push_back(std::make_pair(bf::path(configPath_), "config"));236 directories.push_back(std::make_pair(bf::path(logPath_), "log"));236 directories.push_back(std::make_pair(bf::path(configPath_), std::string("config"))); 237 directories.push_back(std::make_pair(bf::path(logPath_), std::string("log"))); 237 238 238 239 for (std::vector<std::pair<bf::path, std::string> >::iterator it = directories.begin(); … … 242 243 { 243 244 ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \ 244 Please remove " + it->first. string());245 Please remove " + it->first.BF_GENERIC_STRING()); 245 246 } 246 247 if (bf::create_directories(it->first)) // function may not return true at all (bug?) … … 259 260 size_t moduleextensionlength = moduleextension.size(); 260 261 262 #ifdef ORXONOX_PLATFORM_WINDOWS 261 263 // Add that path to the PATH variable in case a module depends on another one 262 std::string pathVariable(getenv("PATH")); 263 putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str())); 264 const char* currentPATH = getenv("PATH"); 265 std::string newPATH = modulePath_.BF_NATIVE_STRING(); 266 if (currentPATH != NULL) 267 newPATH = std::string(currentPATH) + ';' + newPATH; 268 putenv(const_cast<char*>(("PATH=" + newPATH).c_str())); 269 #endif 264 270 265 271 // Make sure the path exists, otherwise don't load modules … … 273 279 while (file != end) 274 280 { 275 const std::string& filename = file->BOOST_LEAF_FUNCTION();276 277 // Check if the file ends with the ex ension in question281 std::string filename = file->BF_LEAF(); 282 283 // Check if the file ends with the extension in question 278 284 if (filename.size() > moduleextensionlength) 279 285 { … … 282 288 // We've found a helper file 283 289 const std::string& library = filename.substr(0, filename.size() - moduleextensionlength); 284 modulePaths.push_back( (modulePath_ / library).file_string());290 modulePaths.push_back(getModulePathString() + library); 285 291 } 286 292 } … … 293 299 /*static*/ std::string PathConfig::getRootPathString() 294 300 { 295 return getInstance().rootPath_. string() + '/';301 return getInstance().rootPath_.BF_GENERIC_STRING() + '/'; 296 302 } 297 303 298 304 /*static*/ std::string PathConfig::getExecutablePathString() 299 305 { 300 return getInstance().executablePath_. string() + '/';306 return getInstance().executablePath_.BF_GENERIC_STRING() + '/'; 301 307 } 302 308 303 309 /*static*/ std::string PathConfig::getDataPathString() 304 310 { 305 return getInstance().dataPath_. string() + '/';311 return getInstance().dataPath_.BF_GENERIC_STRING() + '/'; 306 312 } 307 313 308 314 /*static*/ std::string PathConfig::getExternalDataPathString() 309 315 { 310 return getInstance().externalDataPath_. string() + '/';316 return getInstance().externalDataPath_.BF_GENERIC_STRING() + '/'; 311 317 } 312 318 313 319 /*static*/ std::string PathConfig::getConfigPathString() 314 320 { 315 return getInstance().configPath_. string() + '/';321 return getInstance().configPath_.BF_GENERIC_STRING() + '/'; 316 322 } 317 323 318 324 /*static*/ std::string PathConfig::getLogPathString() 319 325 { 320 return getInstance().logPath_. string() + '/';326 return getInstance().logPath_.BF_GENERIC_STRING() + '/'; 321 327 } 322 328 323 329 /*static*/ std::string PathConfig::getModulePathString() 324 330 { 325 return getInstance().modulePath_. string() + '/';331 return getInstance().modulePath_.BF_GENERIC_STRING() + '/'; 326 332 } 327 333 } -
code/trunk/src/libraries/core/PathConfig.h
r7427 r8351 113 113 static std::string getModulePathString(); 114 114 115 //! Return tr rue for runs in the build directory (not installed)115 //! Return true for runs in the build directory (not installed) 116 116 static bool isDevelopmentRun() { return getInstance().bDevRun_; } 117 117 -
code/trunk/src/libraries/core/Resource.cc
r6746 r8351 34 34 #include <OgreResourceGroupManager.h> 35 35 36 // Differentiate Boost Filesystem v2 and v3 37 #if (BOOST_FILESYSTEM_VERSION < 3) 38 # define BF_GENERIC_STRING string 39 #else 40 # define BF_GENERIC_STRING generic_string 41 #endif 42 36 43 namespace orxonox 37 44 { 38 std::string Resource::DEFAULT_GROUP(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 45 const std::string& Resource::getDefaultResourceGroup() 46 { 47 return Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME; 48 } 39 49 40 50 DataStreamPtr Resource::open(const std::string& name) 41 51 { 42 52 return Ogre::ResourceGroupManager::getSingleton().openResource(name, 43 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);53 getDefaultResourceGroup(), true); 44 54 } 45 55 … … 95 105 boost::filesystem::path base(it->archive->getName()); 96 106 base /= it->filename; 97 ptr->fileSystemPath = base. string();107 ptr->fileSystemPath = base.BF_GENERIC_STRING(); 98 108 } 99 109 return ptr; -
code/trunk/src/libraries/core/Resource.h
r7401 r8351 137 137 138 138 //! Name of the default resource group (usually "General") 139 static std::string DEFAULT_GROUP;139 static const std::string& getDefaultResourceGroup(); 140 140 141 141 private: -
code/trunk/src/libraries/core/Super.h
r7401 r8351 94 94 struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> \ 95 95 { \ 96 static void check() \96 static void superCheck() \ 97 97 { \ 98 98 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \ 99 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>:: check(); \99 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \ 100 100 } \ 101 101 \ … … 132 132 struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \ 133 133 { \ 134 static void check() \135 { \ 136 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>:: check(); \134 static void superCheck() \ 135 { \ 136 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \ 137 137 } \ 138 138 }; … … 150 150 struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> 151 151 { 152 static void check()152 static void superCheck() 153 153 { 154 154 // This call to the apply-function is the whole check. By calling the function with … … 156 156 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); 157 157 158 // Go go the check for of next super-function (functionnumber + 1)159 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>:: check();158 // Go go the superCheck for of next super-function (functionnumber + 1) 159 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); 160 160 } 161 161 … … 202 202 struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \ 203 203 { \ 204 // The check function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)205 static void check() \206 { \ 207 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>:: check(); \204 // The superCheck function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1) 205 static void superCheck() \ 206 { \ 207 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \ 208 208 } \ 209 209 }; … … 303 303 struct SuperFunctionCondition 304 304 { 305 static void check() {}305 static void superCheck() {} 306 306 }; 307 307 … … 338 338 struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2> \ 339 339 { \ 340 static void check() \340 static void superCheck() \ 341 341 { \ 342 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>:: check(); \342 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); \ 343 343 } \ 344 344 }; \ … … 421 421 // If this function gets called, the header-file of the super function is not 422 422 // included, so this fallback template (templatehack not specialized) is used 423 static void check()423 static void superCheck() 424 424 { 425 425 // Calls the condition-check of the next super-function (functionnumber + 1) 426 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>:: check();426 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); 427 427 } 428 428 }; … … 574 574 virtual void createSuperFunctionCaller() const 575 575 { 576 SuperFunctionCondition<0, T, 0, 0>:: check();576 SuperFunctionCondition<0, T, 0, 0>::superCheck(); 577 577 } 578 578 -
code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc
r7401 r8351 35 35 36 36 #include <map> 37 #include <boost/version.hpp>38 37 #include <boost/filesystem.hpp> 39 38 … … 47 46 #include "TclThreadManager.h" 48 47 49 // Boost 1.36 has some issues with deprecated functions that have been omitted 50 #if (BOOST_VERSION == 103600) 51 # define BOOST_LEAF_FUNCTION filename 48 // Differentiate Boost Filesystem v2 and v3 49 #if (BOOST_FILESYSTEM_VERSION < 3) 50 # define BF_LEAF leaf 51 # define BF_GENERIC_STRING string 52 # define BF_DICTIONARY_ENTRY_NAME string 52 53 #else 53 # define BOOST_LEAF_FUNCTION leaf 54 # define BF_LEAF path().filename().string 55 # define BF_GENERIC_STRING generic_string 56 # define BF_DICTIONARY_ENTRY_NAME path().string 54 57 #endif 55 58 … … 245 248 else 246 249 { 247 const std::string& dir = startdirectory. string();250 const std::string& dir = startdirectory.BF_GENERIC_STRING(); 248 251 if (dir.size() > 0 && dir[dir.size() - 1] == ':') 249 252 startdirectory = dir + '/'; … … 257 260 { 258 261 if (boost::filesystem::is_directory(*file)) 259 dirlist.push_back(ArgumentCompletionListElement(file-> string() + '/', getLowercase(file->string()) + '/', file->BOOST_LEAF_FUNCTION() + '/'));262 dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/')); 260 263 else 261 filelist.push_back(ArgumentCompletionListElement(file-> string(), getLowercase(file->string()), file->BOOST_LEAF_FUNCTION()));264 filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF())); 262 265 ++file; 263 266 } -
code/trunk/src/libraries/core/command/TclThreadManager.cc
r8079 r8351 116 116 TclThreadManager::~TclThreadManager() 117 117 { 118 delete this->interpreterBundles_[0]; 118 119 delete this->interpreterBundlesMutex_; 119 // delete this->mainInterpreterMutex_; // <-- temporar y disabled to avoid crash if a thread is still actively queriyng120 // delete this->mainInterpreterMutex_; // <-- temporarily disabled to avoid crash if a thread is still actively querying 120 121 delete this->messageQueue_; 121 122 } -
code/trunk/src/libraries/core/input/InputDevice.h
r7271 r8351 184 184 protected: 185 185 //! Common code for all button pressed events (updates pressed buttons list and calls the input states) 186 FORCEINLINE void buttonPressed(ButtonTypeParam button)186 ORX_FORCEINLINE void buttonPressed(ButtonTypeParam button) 187 187 { 188 188 // check whether the button already is in the list (can happen when focus was lost) … … 201 201 202 202 //! Common code for all button released events (updates pressed buttons list and calls the input states) 203 FORCEINLINE void buttonReleased(ButtonTypeParam button)203 ORX_FORCEINLINE void buttonReleased(ButtonTypeParam button) 204 204 { 205 205 // remove the button from the pressedButtons_ list -
code/trunk/src/libraries/core/input/InputManager.cc
r8079 r8351 151 151 assert(devices_.size() == InputDeviceEnumerator::FirstJoyStick); 152 152 153 typedef std::pair<std::string, std::string> StringPair; 154 153 155 // Fill parameter list 154 156 OIS::ParamList paramList; 155 157 size_t windowHnd = GraphicsManager::getInstance().getRenderWindowHandle(); 156 paramList.insert( std::make_pair("WINDOW", multi_cast<std::string>(windowHnd)));158 paramList.insert(StringPair("WINDOW", multi_cast<std::string>(windowHnd))); 157 159 #if defined(ORXONOX_PLATFORM_WINDOWS) 158 paramList.insert( std::make_pair("w32_keyboard", "DISCL_NONEXCLUSIVE"));159 paramList.insert( std::make_pair("w32_keyboard", "DISCL_FOREGROUND"));160 paramList.insert( std::make_pair("w32_mouse", "DISCL_FOREGROUND"));160 paramList.insert(StringPair("w32_keyboard", "DISCL_NONEXCLUSIVE")); 161 paramList.insert(StringPair("w32_keyboard", "DISCL_FOREGROUND")); 162 paramList.insert(StringPair("w32_mouse", "DISCL_FOREGROUND")); 161 163 if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen()) 162 164 { 163 165 // Disable Windows key plus special keys (like play, stop, next, etc.) 164 paramList.insert( std::make_pair("w32_keyboard", "DISCL_NOWINKEY"));165 paramList.insert( std::make_pair("w32_mouse", "DISCL_EXCLUSIVE"));166 } 167 else 168 paramList.insert( std::make_pair("w32_mouse", "DISCL_NONEXCLUSIVE"));166 paramList.insert(StringPair("w32_keyboard", "DISCL_NOWINKEY")); 167 paramList.insert(StringPair("w32_mouse", "DISCL_EXCLUSIVE")); 168 } 169 else 170 paramList.insert(StringPair("w32_mouse", "DISCL_NONEXCLUSIVE")); 169 171 #elif defined(ORXONOX_PLATFORM_LINUX) 170 172 // Enabling this is probably a bad idea, but whenever orxonox crashes, the setting stays on 171 173 // Trouble might be that the Pressed event occurs a bit too often... 172 paramList.insert( std::make_pair("XAutoRepeatOn", "true"));174 paramList.insert(StringPair("XAutoRepeatOn", "true")); 173 175 174 176 if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen()) 175 177 { 176 178 if (CommandLineParser::getValue("keyboard_no_grab").getBool()) 177 paramList.insert( std::make_pair("x11_keyboard_grab", "false"));179 paramList.insert(StringPair("x11_keyboard_grab", "false")); 178 180 else 179 paramList.insert( std::make_pair("x11_keyboard_grab", "true"));180 paramList.insert( std::make_pair("x11_mouse_grab", "true"));181 paramList.insert( std::make_pair("x11_mouse_hide", "true"));182 } 183 else 184 { 185 paramList.insert( std::make_pair("x11_keyboard_grab", "false"));186 paramList.insert( std::make_pair("x11_mouse_grab", "false"));187 paramList.insert( std::make_pair("x11_mouse_hide", "false"));181 paramList.insert(StringPair("x11_keyboard_grab", "true")); 182 paramList.insert(StringPair("x11_mouse_grab", "true")); 183 paramList.insert(StringPair("x11_mouse_hide", "true")); 184 } 185 else 186 { 187 paramList.insert(StringPair("x11_keyboard_grab", "false")); 188 paramList.insert(StringPair("x11_mouse_grab", "false")); 189 paramList.insert(StringPair("x11_mouse_hide", "false")); 188 190 } 189 191 #endif -
code/trunk/src/libraries/core/input/InputState.h
r7401 r8351 176 176 }; 177 177 178 FORCEINLINE void InputState::update(float dt)178 ORX_FORCEINLINE void InputState::update(float dt) 179 179 { 180 180 for (unsigned int i = 0; i < handlers_.size(); ++i) … … 183 183 } 184 184 185 FORCEINLINE void InputState::update(float dt, unsigned int device)185 ORX_FORCEINLINE void InputState::update(float dt, unsigned int device) 186 186 { 187 187 switch (device) … … 205 205 206 206 template <typename EventType, class ButtonTypeParam> 207 FORCEINLINE void InputState::buttonEvent(unsigned int device, ButtonTypeParam button)207 ORX_FORCEINLINE void InputState::buttonEvent(unsigned int device, ButtonTypeParam button) 208 208 { 209 209 assert(device < handlers_.size()); … … 216 216 } 217 217 218 FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)218 ORX_FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) 219 219 { 220 220 if (handlers_[mouseIndex_s] != NULL) … … 222 222 } 223 223 224 FORCEINLINE void InputState::mouseScrolled(int abs, int rel)224 ORX_FORCEINLINE void InputState::mouseScrolled(int abs, int rel) 225 225 { 226 226 if (handlers_[mouseIndex_s] != NULL) … … 228 228 } 229 229 230 FORCEINLINE void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value)230 ORX_FORCEINLINE void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value) 231 231 { 232 232 assert(device < handlers_.size()); -
code/trunk/src/libraries/core/input/KeyBinder.cc
r8079 r8351 396 396 397 397 // iterate over all modes 398 for ( size_t mode_index = 0; mode_index < 3; ++mode_index)399 { 400 if (mode_index == (unsigned int)new_mode) // skip commands that are already in the desired mode398 for (int mode_index = 0; mode_index < 3; ++mode_index) 399 { 400 if (mode_index == new_mode) // skip commands that are already in the desired mode 401 401 continue; 402 402
Note: See TracChangeset
for help on using the changeset viewer.