Changeset 11054 for code/branches/cpp11_v3/src/libraries/core/GUIManager.cc
- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/libraries/core/GUIManager.cc
r11052 r11054 32 32 #include <fstream> 33 33 #include <memory> 34 #include < boost/bind.hpp>34 #include <functional> 35 35 #include <OgreRenderQueue.h> 36 36 #include <OgreRenderWindow.h> … … 119 119 namespace orxonox 120 120 { 121 namespace arg = std::placeholders; 122 121 123 static void key_esc() 122 124 { GUIManager::getInstance().keyESC(); } … … 126 128 { 127 129 public: 128 v oid logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)130 virtual void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard) override 129 131 { 130 132 OutputLevel orxonoxLevel = level::debug_output; … … 145 147 146 148 /// Carbon copy from CEGUIDefaultLogger.cpp with a bugfix for Windows 147 v oid setLogFilename(const CEGUI::String& filename, bool append = false)149 virtual void setLogFilename(const CEGUI::String& filename, bool append = false) override 148 150 { 149 151 // Close current log file (if any) … … 169 171 d_caching = false; 170 172 171 std::vector<std::pair<CEGUI::String, CEGUI::LoggingLevel> 173 std::vector<std::pair<CEGUI::String, CEGUI::LoggingLevel>>::iterator it = d_cache.begin(); 172 174 173 175 while (it != d_cache.end()) … … 230 232 public: 231 233 /// Callback from Ogre invoked before other stuff in our target queue is rendered 232 v oid renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue)234 virtual void renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue) override 233 235 { 234 236 if (id == Ogre::RENDER_QUEUE_OVERLAY && invocation.empty()) … … 252 254 static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button); 253 255 254 GUIManager* GUIManager::singletonPtr_s = 0;256 GUIManager* GUIManager::singletonPtr_s = nullptr; 255 257 /*static*/ const std::string GUIManager::defaultScheme_ = "TaharezGreen"; //Alternative: Orxonox (not fully complete yet, see the graphics menu) 256 258 … … 291 293 */ 292 294 GUIManager::GUIManager(const std::pair<int, int>& mousePosition) 293 : guiRenderer_( NULL)294 , resourceProvider_( NULL)295 : guiRenderer_(nullptr) 296 , resourceProvider_(nullptr) 295 297 #ifndef ORXONOX_OLD_CEGUI 296 , rqListener_( NULL)297 , imageCodec_( NULL)298 #endif 299 , luaState_( NULL)300 , scriptModule_( NULL)301 , guiSystem_( NULL)302 , ceguiLogger_( NULL)303 , rootWindow_( NULL)304 , hudRootWindow_( NULL)305 , menuRootWindow_( NULL)306 , camera_( NULL)298 , rqListener_(nullptr) 299 , imageCodec_(nullptr) 300 #endif 301 , luaState_(nullptr) 302 , scriptModule_(nullptr) 303 , guiSystem_(nullptr) 304 , ceguiLogger_(nullptr) 305 , rootWindow_(nullptr) 306 , hudRootWindow_(nullptr) 307 , menuRootWindow_(nullptr) 308 , camera_(nullptr) 307 309 , destructionHelper_(this) 308 310 { … … 353 355 354 356 // Create our own logger to specify the filepath 355 std:: auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());357 std::unique_ptr<CEGUILogger> ceguiLogger(new CEGUILogger()); 356 358 ceguiLogger->setLogFilename(ConfigurablePaths::getLogPathString() + "cegui.log"); 357 359 ceguiLogger->setLoggingLevel(static_cast<CEGUI::LoggingLevel>(this->outputLevelCeguiLog_)); … … 360 362 // Create the CEGUI system singleton 361 363 #ifdef ORXONOX_OLD_CEGUI 362 guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_);364 guiSystem_ = new System(guiRenderer_, resourceProvider_, nullptr, scriptModule_); 363 365 // Add functions that have been renamed in newer versions 364 366 luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme"); … … 366 368 luaState_->doString("CEGUI.ImagesetManager.createFromImageFile= CEGUI.ImagesetManager.createImagesetFromImageFile"); 367 369 #else 368 guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_);370 guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, nullptr, imageCodec_, scriptModule_); 369 371 #endif 370 372 … … 474 476 { 475 477 assert(guiSystem_); 476 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectTimePulse,_1, time.getDeltaTime()));478 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectTimePulse, arg::_1, time.getDeltaTime())); 477 479 } 478 480 … … 490 492 { 491 493 #ifdef ORXONOX_OLD_CEGUI 492 if (camera == NULL)493 this->guiRenderer_->setTargetSceneManager( 0);494 if (camera == nullptr) 495 this->guiRenderer_->setTargetSceneManager(nullptr); 494 496 else 495 497 this->guiRenderer_->setTargetSceneManager(camera->getSceneManager()); 496 498 #else 497 if (camera_ != NULL && camera_->getSceneManager() != NULL)499 if (camera_ != nullptr && camera_->getSceneManager() != nullptr) 498 500 camera_->getSceneManager()->removeRenderQueueListener(rqListener_); 499 if (camera != NULL && camera->getSceneManager() != NULL)501 if (camera != nullptr && camera->getSceneManager() != nullptr) 500 502 camera->getSceneManager()->addRenderQueueListener(rqListener_); 501 503 #endif … … 672 674 { 673 675 #if CEGUI_VERSION >= 0x000800 674 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectKeyDown,_1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work?675 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectChar,_1, evt.getText()));676 #else 677 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectKeyDown,_1, evt.getKeyCode()));678 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectChar,_1, evt.getText()));676 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectKeyDown, arg::_1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work? 677 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectChar, arg::_1, evt.getText())); 678 #else 679 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectKeyDown, arg::_1, evt.getKeyCode())); 680 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectChar, arg::_1, evt.getText())); 679 681 #endif 680 682 } … … 683 685 { 684 686 #if CEGUI_VERSION >= 0x000800 685 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectKeyUp,_1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work?686 #else 687 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectKeyUp,_1, evt.getKeyCode()));687 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectKeyUp, arg::_1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work? 688 #else 689 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectKeyUp, arg::_1, evt.getKeyCode())); 688 690 #endif 689 691 } … … 701 703 { 702 704 #if CEGUI_VERSION >= 0x000800 703 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectMouseButtonDown,_1, convertButton(id)));704 #else 705 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectMouseButtonDown,_1, convertButton(id)));705 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseButtonDown, arg::_1, convertButton(id))); 706 #else 707 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseButtonDown, arg::_1, convertButton(id))); 706 708 #endif 707 709 } … … 719 721 { 720 722 #if CEGUI_VERSION >= 0x000800 721 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectMouseButtonUp,_1, convertButton(id)));722 #else 723 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectMouseButtonUp,_1, convertButton(id)));723 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseButtonUp, arg::_1, convertButton(id))); 724 #else 725 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseButtonUp, arg::_1, convertButton(id))); 724 726 #endif 725 727 } … … 728 730 { 729 731 #if CEGUI_VERSION >= 0x000800 730 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectMousePosition,_1, (float)abs.x, (float)abs.y));731 #else 732 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectMousePosition,_1, (float)abs.x, (float)abs.y));732 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMousePosition, arg::_1, (float)abs.x, (float)abs.y)); 733 #else 734 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMousePosition, arg::_1, (float)abs.x, (float)abs.y)); 733 735 #endif 734 736 } … … 737 739 { 738 740 #if CEGUI_VERSION >= 0x000800 739 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectMouseWheelChange,_1, (float)sgn(rel) * this->numScrollLines_));740 #else 741 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectMouseWheelChange,_1, (float)sgn(rel) * this->numScrollLines_));741 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseWheelChange, arg::_1, (float)sgn(rel) * this->numScrollLines_)); 742 #else 743 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseWheelChange, arg::_1, (float)sgn(rel) * this->numScrollLines_)); 742 744 #endif 743 745 } … … 749 751 { 750 752 #if CEGUI_VERSION >= 0x000800 751 this->protectedCeguiContextCall( boost::bind(&CEGUI::GUIContext::injectMouseLeaves,_1));752 #else 753 this->protectedCeguiSystemCall( boost::bind(&CEGUI::System::injectMouseLeaves,_1));753 this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseLeaves, arg::_1)); 754 #else 755 this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseLeaves, arg::_1)); 754 756 #endif 755 757 } … … 798 800 terminate the whole program... 799 801 @note 800 Your life gets easier if you use boost::bind to create the object/function.802 Your life gets easier if you use std::bind to create the object/function. 801 803 @param function 802 804 Any callable object/function that takes this->guiSystem_ as its only parameter. … … 921 923 return; 922 924 923 CEGUI::Font* font = NULL;925 CEGUI::Font* font = nullptr; 924 926 CEGUI::XMLAttributes xmlAttributes; 925 927 … … 937 939 938 940 font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes); 939 if(font != NULL)941 if(font != nullptr) 940 942 font->load(); 941 943 #else
Note: See TracChangeset
for help on using the changeset viewer.