Changeset 9671 for code/branches/libs/src
- Timestamp:
- Sep 8, 2013, 7:30:20 PM (11 years ago)
- Location:
- code/branches/libs/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/libs/src/libraries/core/GUIManager.cc
r9670 r9671 230 230 if (id == Ogre::RENDER_QUEUE_OVERLAY && invocation.empty()) 231 231 { 232 #if CEGUI_VERSION >= 0x000800 233 CEGUI::System::getSingleton().renderAllGUIContexts(); 234 #else 232 235 CEGUI::System::getSingleton().renderGUI(); 236 #endif 233 237 234 238 // Important workaround! (at least required by CEGUI 0.7.5) … … 354 358 355 359 // Align CEGUI mouse with OIS mouse 360 #if CEGUI_VERSION >= 0x000800 361 guiSystem_->getDefaultGUIContext().injectMousePosition((float)mousePosition.first, (float)mousePosition.second); 362 #else 356 363 guiSystem_->injectMousePosition((float)mousePosition.first, (float)mousePosition.second); 364 #endif 357 365 358 366 // Initialise the Lua framework and load the schemes … … 366 374 this->menuRootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "MenuRootWindow"); 367 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 368 381 CEGUI::System::getSingleton().setGUISheet(this->rootWindow_); 369 382 this->rootWindow_->addChildWindow(this->hudRootWindow_); 370 383 this->rootWindow_->addChildWindow(this->menuRootWindow_); 384 #endif 371 385 372 386 // No background to start with (sets the alpha value to 0) … … 435 449 { 436 450 assert(guiSystem_); 437 this->protectedC all(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime()));451 this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime())); 438 452 } 439 453 … … 610 624 void GUIManager::buttonPressed(const KeyEvent& evt) 611 625 { 612 this->protectedCall(boost::bind(&CEGUI::System::injectKeyDown, _1, evt.getKeyCode())); 613 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 614 633 } 615 634 616 635 void GUIManager::buttonReleased(const KeyEvent& evt) 617 636 { 618 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 619 642 } 620 643 … … 630 653 void GUIManager::buttonPressed(MouseButtonCode::ByEnum id) 631 654 { 632 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 633 660 } 634 661 … … 644 671 void GUIManager::buttonReleased(MouseButtonCode::ByEnum id) 645 672 { 646 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 647 678 } 648 679 649 680 void GUIManager::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) 650 681 { 651 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 652 687 } 653 688 654 689 void GUIManager::mouseScrolled(int abs, int rel) 655 690 { 656 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 657 696 } 658 697 … … 662 701 void GUIManager::mouseLeft() 663 702 { 664 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 665 708 } 666 709 … … 714 757 True if input was handled, false otherwise. A caught exception yields true. 715 758 */ 716 template <typename FunctionType >717 bool GUIManager::protectedCall(FunctionType function )759 template <typename FunctionType, typename ObjectType> 760 bool GUIManager::protectedCall(FunctionType function, ObjectType object) 718 761 { 719 762 try 720 763 { 721 return function( this->guiSystem_);764 return function(object); 722 765 } 723 766 catch (CEGUI::ScriptException& ex) … … 728 771 } 729 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 730 787 731 788 /** … … 784 841 void GUIManager::windowResized(unsigned int newWidth, unsigned int newHeight) 785 842 { 843 #if CEGUI_VERSION >= 0x000800 844 this->guiRenderer_->setDisplaySize(CEGUI::Sizef((float)newWidth, (float)newHeight)); 845 #else 786 846 this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight)); 847 #endif 787 848 } 788 849 … … 834 895 return; 835 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 836 900 CEGUI::FontManager::getSingleton().createFreeTypeFont(name, (float)size, true, fontName, "", true, 800.0f, 600.0f); 901 #endif 837 902 #endif 838 903 } -
code/branches/libs/src/libraries/core/GUIManager.h
r9670 r9671 156 156 void executeCode(const std::string& str); 157 157 158 template <typename FunctionType, typename ObjectType> 159 bool protectedCall(FunctionType function, ObjectType object); 160 158 161 template <typename FunctionType> 159 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 160 168 161 169 void changedCeguiOutputLevel(); -
code/branches/libs/src/orxonox/chat/ChatInputHandler.cc
r8858 r9671 31 31 #include <cassert> 32 32 #include <string> 33 #include <CEGUIWindow.h> 34 #include <CEGUIWindowManager.h> 35 #include <elements/CEGUIListbox.h> 36 #include <elements/CEGUIListboxItem.h> 37 #include <elements/CEGUIListboxTextItem.h> 33 34 #if CEGUI_VERSION >= 0x000800 35 # include <CEGUI/Window.h> 36 # include <CEGUI/WindowManager.h> 37 # include <CEGUI/widgets/Listbox.h> 38 # include <CEGUI/widgets/ListboxItem.h> 39 # include <CEGUI/widgets/ListboxTextItem.h> 40 #else 41 # include <CEGUIWindow.h> 42 # include <CEGUIWindowManager.h> 43 # include <elements/CEGUIListbox.h> 44 # include <elements/CEGUIListboxItem.h> 45 # include <elements/CEGUIListboxTextItem.h> 46 #endif 38 47 39 48 #include "util/ScopedSingletonManager.h" … … 118 127 119 128 /* GET WINDOW POINTERS */ 129 #if CEGUI_VERSION >= 0x000800 130 input = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox/input" ); 131 inputonly = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox-inputonly/input" ); 132 CEGUI::Window *history = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->getChild( "orxonox/ChatBox/history" ); 133 #else 120 134 input = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/input" ); 121 135 inputonly = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox-inputonly/input" ); 122 123 /* get pointer to the history window */124 136 CEGUI::Window *history = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/history" ); 137 #endif 125 138 126 139 /* cast it to a listbox */ … … 141 154 // reds 142 155 for( i = 0; i < NumberOfColors/3; ++i ) 143 { this->text_colors[ i ] = CEGUI ::colour( red, green, blue );156 { this->text_colors[ i ] = CEGUIColour( red, green, blue ); 144 157 green += 0.2f, blue += 0.2f; 145 158 } … … 148 161 red = 0.5, green = 1, blue = 0.5; 149 162 for( ; i < NumberOfColors*2/3; ++i ) 150 { this->text_colors[ i ] = CEGUI ::colour( red, green, blue );163 { this->text_colors[ i ] = CEGUIColour( red, green, blue ); 151 164 red += 0.2f, blue += 0.2f; 152 165 } … … 155 168 red = 0.5, green = 0.5, blue = 1; 156 169 for( ; i < NumberOfColors; ++i ) 157 { this->text_colors[ i ] = CEGUI ::colour( red, green, blue );170 { this->text_colors[ i ] = CEGUIColour( red, green, blue ); 158 171 red += 0.2f, green += 0.2f; 159 172 } … … 272 285 { 273 286 /* adjust curser position - magic number 5 for font width */ 274 sub_adjust_dispoffset( (int)(this->input->getUnclippedInnerRect().getWidth()/6), 275 cursorpos, assembled.length() ); 287 #if CEGUI_VERSION >= 0x000800 288 sub_adjust_dispoffset( (int)(this->input->getUnclippedInnerRect().get().getWidth()/6), cursorpos, assembled.length() ); 289 #else 290 sub_adjust_dispoffset( (int)(this->input->getUnclippedInnerRect().getWidth()/6), cursorpos, assembled.length() ); 291 #endif 276 292 this->input->setProperty( "Text", assembled.substr( disp_offset ) ); 277 293 } … … 279 295 { 280 296 /* adjust curser position - magic number 5 for font width */ 281 sub_adjust_dispoffset( (int)(this->inputonly->getUnclippedInnerRect().getWidth()/6), 282 cursorpos, assembled.length() ); 297 #if CEGUI_VERSION >= 0x000800 298 sub_adjust_dispoffset( (int)(this->inputonly->getUnclippedInnerRect().get().getWidth()/6), cursorpos, assembled.length() ); 299 #else 300 sub_adjust_dispoffset( (int)(this->inputonly->getUnclippedInnerRect().getWidth()/6), cursorpos, assembled.length() ); 301 #endif 283 302 this->inputonly->setProperty( "Text", assembled.substr( disp_offset) ); 284 303 } -
code/branches/libs/src/orxonox/chat/ChatInputHandler.h
r8858 r9671 33 33 34 34 #include <string> 35 #include <CEGUIForwardRefs.h> 36 #include <CEGUIcolour.h> 35 36 #if CEGUI_VERSION >= 0x000800 37 # include <CEGUI/ForwardRefs.h> 38 # include <CEGUI/Colour.h> 39 #else 40 # include <CEGUIForwardRefs.h> 41 # include <CEGUIcolour.h> 42 #endif 37 43 38 44 #include "util/Singleton.h" … … 41 47 namespace orxonox // tolua_export 42 48 { // tolua_export 49 50 #if CEGUI_VERSION >= 0x000800 51 typedef CEGUI::Colour CEGUIColour; 52 #else 53 typedef CEGUI::colour CEGUIColour; 54 #endif 55 43 56 /* class to handle chat using an InputBuffer */ 44 57 class _OrxonoxExport ChatInputHandler // tolua_export … … 55 68 /* colors for nickname coloring */ 56 69 static const int NumberOfColors = 10; 57 CEGUI ::colour text_colors[ NumberOfColors ];70 CEGUIColour text_colors[ NumberOfColors ]; 58 71 59 72 /** input state */
Note: See TracChangeset
for help on using the changeset viewer.