Changeset 9675 for code/trunk/src/libraries
- Timestamp:
- Sep 26, 2013, 11:03:33 PM (11 years ago)
- Location:
- code/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/libs (added) merged: 9668-9671
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/CorePrereqs.h
r9667 r9675 38 38 #include "OrxonoxConfig.h" 39 39 #include <boost/version.hpp> 40 #include <CEGUIVersion.h>41 40 42 41 //----------------------------------------------------------------------- -
code/trunk/src/libraries/core/GUIManager.cc
r9667 r9675 36 36 #include <OgreRenderWindow.h> 37 37 38 #include <CEGUIDefaultLogger.h> 39 #include <CEGUIExceptions.h> 40 #include <CEGUIFontManager.h> 41 #include <CEGUIInputEvent.h> 42 #include <CEGUIMouseCursor.h> 43 #include <CEGUIResourceProvider.h> 44 #include <CEGUISystem.h> 45 #include <CEGUIWindow.h> 46 #include <CEGUIWindowManager.h> 47 #include <CEGUIXMLAttributes.h> 48 #include <elements/CEGUIListbox.h> 49 #include <elements/CEGUIListboxItem.h> 38 #if CEGUI_VERSION >= 0x000800 39 # include <CEGUI/DefaultLogger.h> 40 # include <CEGUI/Exceptions.h> 41 # include <CEGUI/FontManager.h> 42 # include <CEGUI/InputEvent.h> 43 # include <CEGUI/MouseCursor.h> 44 # include <CEGUI/ResourceProvider.h> 45 # include <CEGUI/System.h> 46 # include <CEGUI/Window.h> 47 # include <CEGUI/WindowManager.h> 48 # include <CEGUI/XMLAttributes.h> 49 # include <CEGUI/widgets/Listbox.h> 50 # include <CEGUI/widgets/ListboxItem.h> 51 #else 52 # include <CEGUIDefaultLogger.h> 53 # include <CEGUIExceptions.h> 54 # include <CEGUIFontManager.h> 55 # include <CEGUIInputEvent.h> 56 # include <CEGUIMouseCursor.h> 57 # include <CEGUIResourceProvider.h> 58 # include <CEGUISystem.h> 59 # include <CEGUIWindow.h> 60 # include <CEGUIWindowManager.h> 61 # include <CEGUIXMLAttributes.h> 62 # include <elements/CEGUIListbox.h> 63 # include <elements/CEGUIListboxItem.h> 64 #endif 50 65 51 66 #ifdef ORXONOX_OLD_CEGUI 52 # include <CEGUILua.h>53 # include <ogreceguirenderer/OgreCEGUIRenderer.h>67 # include <CEGUILua.h> 68 # include <ogreceguirenderer/OgreCEGUIRenderer.h> 54 69 extern "C" { 55 # include <lauxlib.h>70 # include <lauxlib.h> 56 71 } 57 72 #else 58 # include <ScriptingModules/LuaScriptModule/CEGUILua.h> 59 # include <RendererModules/Ogre/CEGUIOgreImageCodec.h> 60 # include <RendererModules/Ogre/CEGUIOgreRenderer.h> 61 # include <RendererModules/Ogre/CEGUIOgreResourceProvider.h> 62 # include <OgreCamera.h> 63 # include <OgreRenderQueueListener.h> 64 # include <OgreRenderSystem.h> 65 # include <OgreRoot.h> 66 # include <OgreSceneManager.h> 73 # if CEGUI_VERSION >= 0x000800 74 # include <CEGUI/ScriptModules/Lua/ScriptModule.h> 75 # include <CEGUI/RendererModules/Ogre/ImageCodec.h> 76 # include <CEGUI/RendererModules/Ogre/Renderer.h> 77 # include <CEGUI/RendererModules/Ogre/ResourceProvider.h> 78 # else 79 # include <ScriptingModules/LuaScriptModule/CEGUILua.h> 80 # include <RendererModules/Ogre/CEGUIOgreImageCodec.h> 81 # include <RendererModules/Ogre/CEGUIOgreRenderer.h> 82 # include <RendererModules/Ogre/CEGUIOgreResourceProvider.h> 83 # endif 84 # include <OgreCamera.h> 85 # include <OgreRenderQueueListener.h> 86 # include <OgreRenderSystem.h> 87 # include <OgreRoot.h> 88 # include <OgreSceneManager.h> 67 89 #endif 68 90 … … 208 230 if (id == Ogre::RENDER_QUEUE_OVERLAY && invocation.empty()) 209 231 { 232 #if CEGUI_VERSION >= 0x000800 233 CEGUI::System::getSingleton().renderAllGUIContexts(); 234 #else 210 235 CEGUI::System::getSingleton().renderGUI(); 236 #endif 211 237 212 238 // Important workaround! (at least required by CEGUI 0.7.5) … … 332 358 333 359 // Align CEGUI mouse with OIS mouse 360 #if CEGUI_VERSION >= 0x000800 361 guiSystem_->getDefaultGUIContext().injectMousePosition((float)mousePosition.first, (float)mousePosition.second); 362 #else 334 363 guiSystem_->injectMousePosition((float)mousePosition.first, (float)mousePosition.second); 364 #endif 335 365 336 366 // Initialise the Lua framework and load the schemes … … 344 374 this->menuRootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "MenuRootWindow"); 345 375 // And connect them 376 #if CEGUI_VERSION >= 0x000800 377 CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(this->rootWindow_); 378 this->rootWindow_->addChild(this->hudRootWindow_); 379 this->rootWindow_->addChild(this->menuRootWindow_); 380 #else 346 381 CEGUI::System::getSingleton().setGUISheet(this->rootWindow_); 347 382 this->rootWindow_->addChildWindow(this->hudRootWindow_); 348 383 this->rootWindow_->addChildWindow(this->menuRootWindow_); 384 #endif 349 385 350 386 // No background to start with (sets the alpha value to 0) … … 413 449 { 414 450 assert(guiSystem_); 415 this->protectedC all(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime()));451 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime())); 416 452 } 417 453 … … 588 624 void GUIManager::buttonPressed(const KeyEvent& evt) 589 625 { 590 this->protectedCall(boost::bind(&CEGUI::System::injectKeyDown, _1, evt.getKeyCode())); 591 this->protectedCall(boost::bind(&CEGUI::System::injectChar, _1, evt.getText())); 626 #if CEGUI_VERSION >= 0x000800 627 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectKeyDown, _1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work? 628 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectChar, _1, evt.getText())); 629 #else 630 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectKeyDown, _1, evt.getKeyCode())); 631 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectChar, _1, evt.getText())); 632 #endif 592 633 } 593 634 594 635 void GUIManager::buttonReleased(const KeyEvent& evt) 595 636 { 596 this->protectedCall(boost::bind(&CEGUI::System::injectKeyUp, _1, evt.getKeyCode())); 637 #if CEGUI_VERSION >= 0x000800 638 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectKeyUp, _1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work? 639 #else 640 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectKeyUp, _1, evt.getKeyCode())); 641 #endif 597 642 } 598 643 … … 608 653 void GUIManager::buttonPressed(MouseButtonCode::ByEnum id) 609 654 { 610 this->protectedCall(boost::bind(&CEGUI::System::injectMouseButtonDown, _1, convertButton(id))); 655 #if CEGUI_VERSION >= 0x000800 656 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseButtonDown, _1, convertButton(id))); 657 #else 658 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseButtonDown, _1, convertButton(id))); 659 #endif 611 660 } 612 661 … … 622 671 void GUIManager::buttonReleased(MouseButtonCode::ByEnum id) 623 672 { 624 this->protectedCall(boost::bind(&CEGUI::System::injectMouseButtonUp, _1, convertButton(id))); 673 #if CEGUI_VERSION >= 0x000800 674 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseButtonUp, _1, convertButton(id))); 675 #else 676 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseButtonUp, _1, convertButton(id))); 677 #endif 625 678 } 626 679 627 680 void GUIManager::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) 628 681 { 629 this->protectedCall(boost::bind(&CEGUI::System::injectMousePosition, _1, (float)abs.x, (float)abs.y)); 682 #if CEGUI_VERSION >= 0x000800 683 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMousePosition, _1, (float)abs.x, (float)abs.y)); 684 #else 685 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMousePosition, _1, (float)abs.x, (float)abs.y)); 686 #endif 630 687 } 631 688 632 689 void GUIManager::mouseScrolled(int abs, int rel) 633 690 { 634 this->protectedCall(boost::bind(&CEGUI::System::injectMouseWheelChange, _1, (float)sgn(rel) * this->numScrollLines_)); 691 #if CEGUI_VERSION >= 0x000800 692 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseWheelChange, _1, (float)sgn(rel) * this->numScrollLines_)); 693 #else 694 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseWheelChange, _1, (float)sgn(rel) * this->numScrollLines_)); 695 #endif 635 696 } 636 697 … … 640 701 void GUIManager::mouseLeft() 641 702 { 642 this->protectedCall(boost::bind(&CEGUI::System::injectMouseLeaves, _1)); 703 #if CEGUI_VERSION >= 0x000800 704 this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseLeaves, _1)); 705 #else 706 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseLeaves, _1)); 707 #endif 643 708 } 644 709 … … 692 757 True if input was handled, false otherwise. A caught exception yields true. 693 758 */ 694 template <typename FunctionType >695 bool GUIManager::protectedCall(FunctionType function )759 template <typename FunctionType, typename ObjectType> 760 bool GUIManager::protectedCall(FunctionType function, ObjectType object) 696 761 { 697 762 try 698 763 { 699 return function( this->guiSystem_);764 return function(object); 700 765 } 701 766 catch (CEGUI::ScriptException& ex) … … 706 771 } 707 772 } 773 774 template <typename FunctionType> 775 bool GUIManager::protectedCeguiSystemCall(FunctionType function) 776 { 777 return this->protectedCall(function, this->guiSystem_); 778 } 779 780 #if CEGUI_VERSION >= 0x000800 781 template <typename FunctionType> 782 bool GUIManager::protectedCeguiContextCall(FunctionType function) 783 { 784 return this->protectedCall(function, this->guiSystem_->getDefaultGUIContext()); 785 } 786 #endif 708 787 709 788 /** … … 762 841 void GUIManager::windowResized(unsigned int newWidth, unsigned int newHeight) 763 842 { 843 #if CEGUI_VERSION >= 0x000800 844 this->guiRenderer_->setDisplaySize(CEGUI::Sizef((float)newWidth, (float)newHeight)); 845 #else 764 846 this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight)); 847 #endif 765 848 } 766 849 … … 812 895 return; 813 896 897 #if CEGUI_VERSION >= 0x000800 898 CEGUI::FontManager::getSingleton().createFreeTypeFont(name, (float)size, true, fontName, "", CEGUI::ASM_Both, CEGUI::Sizef(800.0f, 600.0f)); 899 #else 814 900 CEGUI::FontManager::getSingleton().createFreeTypeFont(name, (float)size, true, fontName, "", true, 800.0f, 600.0f); 901 #endif 815 902 #endif 816 903 } -
code/trunk/src/libraries/core/GUIManager.h
r9667 r9675 40 40 #include <map> 41 41 #include <string> 42 #include <CEGUIForwardRefs.h> 43 #include <CEGUIVersion.h> 42 43 #if CEGUI_VERSION >= 0x000800 44 # include <CEGUI/ForwardRefs.h> 45 # include <CEGUI/Version.h> 46 #else 47 # include <CEGUIForwardRefs.h> 48 # include <CEGUIVersion.h> 49 #endif 50 44 51 #include <boost/shared_ptr.hpp> 45 52 … … 149 156 void executeCode(const std::string& str); 150 157 158 template <typename FunctionType, typename ObjectType> 159 bool protectedCall(FunctionType function, ObjectType object); 160 151 161 template <typename FunctionType> 152 bool protectedCall(FunctionType function); 162 bool protectedCeguiSystemCall(FunctionType function); 163 164 #if CEGUI_VERSION >= 0x000800 165 template <typename FunctionType> 166 bool protectedCeguiContextCall(FunctionType function); 167 #endif 153 168 154 169 void changedCeguiOutputLevel(); -
code/trunk/src/libraries/core/GraphicsManager.cc
r9667 r9675 402 402 The name of this log (so you can have several listeners 403 403 for different logs, and identify them) 404 @param skipThisMessage 405 If set to true by the messageLogged() implementation message will not be logged 404 406 */ 407 #if OGRE_VERSION >= 0x010800 408 void GraphicsManager::messageLogged(const std::string& message, 409 Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName, bool& skipThisMessage) 410 // TODO: do we have to ignore the message if skipThisMessage is set? 411 #else 405 412 void GraphicsManager::messageLogged(const std::string& message, 406 413 Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName) 414 #endif 407 415 { 408 416 OutputLevel orxonoxLevel; -
code/trunk/src/libraries/core/GraphicsManager.h
r9667 r9675 108 108 109 109 // event from Ogre::LogListener 110 void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, 111 bool maskDebug, const std::string& logName); 110 #if OGRE_VERSION >= 0x010800 111 void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName, bool& skipThisMessage); 112 #else 113 void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName); 114 #endif 112 115 113 116 // console commands -
code/trunk/src/libraries/core/Resource.cc
r8351 r9675 101 101 ptr->group = group; 102 102 ptr->size = it->uncompressedSize; 103 #if OGRE_VERSION >= 0x010800 104 if (dynamic_cast<const Ogre::FileSystemArchive*>(it->archive) != NULL) 105 #else 103 106 if (dynamic_cast<Ogre::FileSystemArchive*>(it->archive) != NULL) 107 #endif 104 108 { 105 109 boost::filesystem::path base(it->archive->getName()); -
code/trunk/src/libraries/util/Exception.cc
r8858 r9675 36 36 37 37 #include <cstddef> 38 #include <CEGUIExceptions.h> 38 39 #if CEGUI_VERSION >= 0x000800 40 # include <CEGUI/Exceptions.h> 41 #else 42 # include <CEGUIExceptions.h> 43 #endif 44 39 45 #include "Output.h" 40 46
Note: See TracChangeset
for help on using the changeset viewer.