Changeset 7960 for code/branches/kicklib/src/libraries/core/GUIManager.cc
- Timestamp:
- Feb 25, 2011, 3:07:17 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib/src/libraries/core/GUIManager.cc
r7957 r7960 32 32 #include <memory> 33 33 #include <boost/bind.hpp> 34 #include <OgreRenderQueue.h> 35 #include <OgreRenderWindow.h> 34 36 35 37 #include <CEGUIDefaultLogger.h> … … 44 46 #include <elements/CEGUIListboxItem.h> 45 47 46 #include <CEGUILua.h> 47 #include <ogreceguirenderer/OgreCEGUIRenderer.h> 48 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 49 # include <CEGUILua.h> 50 # include <ogreceguirenderer/OgreCEGUIRenderer.h> 51 #else 52 # include <ScriptingModules/LuaScriptModule/CEGUILua.h> 53 # include <RendererModules/Ogre/CEGUIOgreImageCodec.h> 54 # include <RendererModules/Ogre/CEGUIOgreRenderer.h> 55 # include <RendererModules/Ogre/CEGUIOgreResourceProvider.h> 56 #endif 48 57 49 58 #include "util/Clock.h" … … 118 127 , guiSystem_(NULL) 119 128 , resourceProvider_(NULL) 129 #if CEGUI_VERSION_MAJOR >= 1 || CEGUI_VERSION_MINOR >= 7 130 , imageCodec_(NULL) 131 #endif 120 132 , camera_(NULL) 121 133 { … … 128 140 129 141 // Note: No SceneManager specified yet 142 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 130 143 guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000); 131 144 resourceProvider_ = guiRenderer_->createResourceProvider(); 145 #else 146 guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow()); 147 resourceProvider_ = &OgreRenderer::createOgreResourceProvider(); 148 imageCodec_ = &OgreRenderer::createOgreImageCodec(); 149 #endif 132 150 resourceProvider_->setDefaultResourceGroup("General"); 133 151 … … 137 155 // This is necessary to ensure that input events also use the right resource info when triggering lua functions 138 156 luaState_->setDefaultResourceInfo(this->rootFileInfo_); 157 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 139 158 scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState()); 159 #else 160 scriptModule_ = &LuaScriptModule::create(luaState_->getInternalLuaState()); 161 #endif 140 162 scriptModule_->setDefaultPCallErrorHandler(LuaState::ERROR_HANDLER_NAME); 141 163 … … 149 171 150 172 // Create the CEGUI system singleton 173 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 151 174 guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_); 175 #else 176 guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_); 177 #endif 152 178 153 179 // Align CEGUI mouse with OIS mouse … … 178 204 using namespace CEGUI; 179 205 206 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 180 207 delete guiSystem_; 181 208 delete guiRenderer_; 182 209 delete scriptModule_; 210 #else 211 System::destroy(); 212 OgreRenderer::destroyOgreResourceProvider(*resourceProvider_); 213 OgreRenderer::destroyOgreImageCodec(*imageCodec_); 214 OgreRenderer::destroy(*guiRenderer_); 215 LuaScriptModule::destroy(*scriptModule_); 216 #endif 183 217 delete luaState_; 184 218 } … … 223 257 { 224 258 this->camera_ = camera; 259 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 225 260 if (camera == NULL) 226 261 this->guiRenderer_->setTargetSceneManager(0); 227 262 else 228 263 this->guiRenderer_->setTargetSceneManager(camera->getSceneManager()); 264 #endif 229 265 } 230 266 … … 512 548 void GUIManager::windowResized(unsigned int newWidth, unsigned int newHeight) 513 549 { 550 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 514 551 this->guiRenderer_->setDisplaySize(CEGUI::Size(newWidth, newHeight)); 552 #else 553 this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight)); 554 #endif 515 555 } 516 556
Note: See TracChangeset
for help on using the changeset viewer.