Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 16, 2010, 2:50:16 PM (14 years ago)
Author:
rgrieder
Message:

Merged gamestates2 branch back to trunk.
This brings in some heavy changes in the GUI framework.
It should also fix problems with triggered asserts in the InputManager.

Note: PickupInventory does not seem to work —> Segfault when showing because before, the owner in GUIOverlay::setGUIName is already NULL.
I haven't tested it before, so I can't tell whether it's my changes.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r6417 r6746  
    4141
    4242#include "util/OgreForwardRefs.h"
     43#include "util/TriBool.h"
    4344#include "util/Singleton.h"
    4445#include "input/InputHandler.h"
     46
     47// Tolua includes (have to be relative to the current directory)
     48/*
     49$cfile "../util/TriBool.h" // tolua_export
     50*/
    4551
    4652namespace orxonox // tolua_export
     
    5460
    5561        The GUIManager is a singleton and can be called anywhere when access on the GUI is needed.
    56         Creation of the GUIManager is therefore not possible and the cunstructor is private.
    5762
    5863        Since the GUI needs user input, the GUIManager implements the functions needed to act as a key and/or mouse handler.
     
    6469        friend class Singleton<GUIManager>;
    6570    public:
    66         GUIManager(Ogre::RenderWindow* renderWindow, const std::pair<int, int>& mousePosition, bool bFullScreen);
     71        GUIManager(const std::pair<int, int>& mousePosition);
    6772        ~GUIManager();
    6873
    6974        void preUpdate(const Clock& time);
    7075
    71         static void showGUI(const std::string& name, bool hidePrevious=false, bool showCursor=true);
    72         void showGUIExtra(const std::string& name, const std::string& ptr, bool hidePrevious=false, bool showCursor=true);
     76        void loadGUI(const std::string& name);
     77        static void showGUI(const std::string& name, bool bHidePrevious = false);
     78        void showGUIExtra(const std::string& name, const std::string& ptr, bool bHidePrevious = false);
    7379        static void hideGUI(const std::string& name);
    7480        void keyESC();
    75         void setBackground(const std::string& name);
     81        void setBackgroundImage(const std::string& imageSet, const std::string imageName); // tolua_export
     82        void setBackgroundImage(const std::string& image);
     83
     84        //! Creates a new InputState to be used with a GUI Sheet
     85        const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export
     86
     87        //! Returns the root window for all menu sheets
     88        CEGUI::Window* getMenuRootWindow() { return this->menuRootWindow_; } // tolua_export
     89        //! Returns the root window for all HUD sheets
     90        CEGUI::Window* getHUDRootWindow() { return this->hudRootWindow_; } // tolua_export
    7691
    7792        void setCamera(Ogre::Camera* camera);
    7893        Ogre::Camera* getCamera() { return this->camera_; }
    79 
    80         static GUIManager* getInstancePtr() { return singletonPtr_s; }
    8194
    8295        inline void setPlayer(const std::string& guiname, PlayerInfo* player)
     
    88101        static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
    89102
     103        static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
     104
    90105    private:
    91106        GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
    92107
    93108        void executeCode(const std::string& str);
     109
     110        template <typename FunctionType>
     111        bool protectedCall(FunctionType function);
    94112
    95113        // keyHandler functions
     
    102120        void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
    103121        void mouseScrolled (int abs, int rel);
    104 
    105122        scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
    106123        scoped_ptr<LuaState>                 luaState_;         //!< LuaState, access point to the Lua engine
     
    108125        scoped_ptr<CEGUI::System>            guiSystem_;        //!< CEGUI's main system
    109126        shared_ptr<ResourceInfo>             rootFileInfo_;     //!< Resource information about the root script
    110         Ogre::RenderWindow*                  renderWindow_;     //!< Ogre's render window to give CEGUI access to it
    111127        CEGUI::ResourceProvider*             resourceProvider_; //!< CEGUI's resource provider
    112128        CEGUI::Logger*                       ceguiLogger_;      //!< CEGUI's logger to be able to log CEGUI errors in our log
    113         std::map<std::string, PlayerInfo*>   players_;          //!< Stores the player (owner) for each gui
     129        CEGUI::Window*                       rootWindow_;       //!< Root node for all windows
     130        CEGUI::Window*                       hudRootWindow_;    //!< Root node for the HUD sheets
     131        CEGUI::Window*                       menuRootWindow_;   //!< Root node for the menu sheets (used by Lua)
     132        std::map<std::string, PlayerInfo*>   players_;          //!< Stores the player (owner) for each GUI
    114133        Ogre::Camera*                        camera_;           //!< Camera used to render the scene with the GUI
    115134
    116135        static GUIManager*                   singletonPtr_s;    //!< Singleton reference to GUIManager
    117         bool                                 bShowIngameGUI_;
    118136
    119137    }; // tolua_export
Note: See TracChangeset for help on using the changeset viewer.