Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 26, 2013, 11:03:33 PM (11 years ago)
Author:
landauf
Message:

merged branch 'libs' back to trunk. orxonox now compiles and runs with ogre 1.8 and it compiles (but doesn't run) with cegui 0.8

Location:
code/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/CorePrereqs.h

    r9667 r9675  
    3838#include "OrxonoxConfig.h"
    3939#include <boost/version.hpp>
    40 #include <CEGUIVersion.h>
    4140
    4241//-----------------------------------------------------------------------
  • code/trunk/src/libraries/core/GUIManager.cc

    r9667 r9675  
    3636#include <OgreRenderWindow.h>
    3737
    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
    5065
    5166#ifdef ORXONOX_OLD_CEGUI
    52 include <CEGUILua.h>
    53 include <ogreceguirenderer/OgreCEGUIRenderer.h>
     67 include <CEGUILua.h>
     68 include <ogreceguirenderer/OgreCEGUIRenderer.h>
    5469extern "C" {
    55 include <lauxlib.h>
     70 include <lauxlib.h>
    5671}
    5772#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>
    6789#endif
    6890
     
    208230            if (id == Ogre::RENDER_QUEUE_OVERLAY && invocation.empty())
    209231            {
     232#if CEGUI_VERSION >= 0x000800
     233                CEGUI::System::getSingleton().renderAllGUIContexts();
     234#else
    210235                CEGUI::System::getSingleton().renderGUI();
     236#endif
    211237
    212238                // Important workaround! (at least required by CEGUI 0.7.5)
     
    332358
    333359        // Align CEGUI mouse with OIS mouse
     360#if CEGUI_VERSION >= 0x000800
     361        guiSystem_->getDefaultGUIContext().injectMousePosition((float)mousePosition.first, (float)mousePosition.second);
     362#else
    334363        guiSystem_->injectMousePosition((float)mousePosition.first, (float)mousePosition.second);
     364#endif
    335365
    336366        // Initialise the Lua framework and load the schemes
     
    344374        this->menuRootWindow_ = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "MenuRootWindow");
    345375        // 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
    346381        CEGUI::System::getSingleton().setGUISheet(this->rootWindow_);
    347382        this->rootWindow_->addChildWindow(this->hudRootWindow_);
    348383        this->rootWindow_->addChildWindow(this->menuRootWindow_);
     384#endif
    349385
    350386        // No background to start with (sets the alpha value to 0)
     
    413449    {
    414450        assert(guiSystem_);
    415         this->protectedCall(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime()));
     451        this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime()));
    416452    }
    417453
     
    588624    void GUIManager::buttonPressed(const KeyEvent& evt)
    589625    {
    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
    592633    }
    593634
    594635    void GUIManager::buttonReleased(const KeyEvent& evt)
    595636    {
    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
    597642    }
    598643
     
    608653    void GUIManager::buttonPressed(MouseButtonCode::ByEnum id)
    609654    {
    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
    611660    }
    612661
     
    622671    void GUIManager::buttonReleased(MouseButtonCode::ByEnum id)
    623672    {
    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
    625678    }
    626679
    627680    void GUIManager::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
    628681    {
    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
    630687    }
    631688
    632689    void GUIManager::mouseScrolled(int abs, int rel)
    633690    {
    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
    635696    }
    636697
     
    640701    void GUIManager::mouseLeft()
    641702    {
    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
    643708    }
    644709
     
    692757        True if input was handled, false otherwise. A caught exception yields true.
    693758    */
    694     template <typename FunctionType>
    695     bool GUIManager::protectedCall(FunctionType function)
     759    template <typename FunctionType, typename ObjectType>
     760    bool GUIManager::protectedCall(FunctionType function, ObjectType object)
    696761    {
    697762        try
    698763        {
    699             return function(this->guiSystem_);
     764            return function(object);
    700765        }
    701766        catch (CEGUI::ScriptException& ex)
     
    706771        }
    707772    }
     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
    708787
    709788    /**
     
    762841    void GUIManager::windowResized(unsigned int newWidth, unsigned int newHeight)
    763842    {
     843#if CEGUI_VERSION >= 0x000800
     844        this->guiRenderer_->setDisplaySize(CEGUI::Sizef((float)newWidth, (float)newHeight));
     845#else
    764846        this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight));
     847#endif
    765848    }
    766849
     
    812895            return;
    813896
     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
    814900        CEGUI::FontManager::getSingleton().createFreeTypeFont(name, (float)size, true, fontName, "", true, 800.0f, 600.0f);
     901    #endif
    815902#endif
    816903    }
  • code/trunk/src/libraries/core/GUIManager.h

    r9667 r9675  
    4040#include <map>
    4141#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
    4451#include <boost/shared_ptr.hpp>
    4552
     
    149156        void executeCode(const std::string& str);
    150157
     158        template <typename FunctionType, typename ObjectType>
     159        bool protectedCall(FunctionType function, ObjectType object);
     160
    151161        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
    153168
    154169        void changedCeguiOutputLevel();
  • code/trunk/src/libraries/core/GraphicsManager.cc

    r9667 r9675  
    402402        The name of this log (so you can have several listeners
    403403        for different logs, and identify them)
     404    @param skipThisMessage
     405        If set to true by the messageLogged() implementation message will not be logged
    404406    */
     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
    405412    void GraphicsManager::messageLogged(const std::string& message,
    406413        Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName)
     414#endif
    407415    {
    408416        OutputLevel orxonoxLevel;
  • code/trunk/src/libraries/core/GraphicsManager.h

    r9667 r9675  
    108108
    109109        // 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
    112115
    113116        // console commands
  • code/trunk/src/libraries/core/Resource.cc

    r8351 r9675  
    101101                ptr->group = group;
    102102                ptr->size = it->uncompressedSize;
     103#if OGRE_VERSION >= 0x010800
     104                if (dynamic_cast<const Ogre::FileSystemArchive*>(it->archive) != NULL)
     105#else
    103106                if (dynamic_cast<Ogre::FileSystemArchive*>(it->archive) != NULL)
     107#endif
    104108                {
    105109                    boost::filesystem::path base(it->archive->getName());
  • code/trunk/src/libraries/util/Exception.cc

    r8858 r9675  
    3636
    3737#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
    3945#include "Output.h"
    4046
Note: See TracChangeset for help on using the changeset viewer.