Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 6, 2009, 1:59:00 AM (15 years ago)
Author:
landauf
Message:

Merged gui branch back to trunk.

I did 2 small changes in IngameManager.cc on line 777 and 888 (yes, really), because const_reverse_iterator strangely doesn't work on MinGW.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/gui/GUIManager.h

    r2790 r2896  
    2323 *      Reto Grieder
    2424 *   Co-authors:
    25  *      ...
     25 *      Benjamin Knecht
    2626 *
    2727 */
     
    4949{
    5050    /**
     51    @class GUIManager
    5152    @brief
    52         Provides a simple interface to CEGUI with tolua methods and console commands
     53        Provides a simple interface to CEGUI with tolua methods and console commands. It also acts as a key and mouse handler.
     54
     55        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.
     57
     58        Since the GUI needs user input, the GUIManager implements the functions needed to act as a key and/or mouse handler.
     59        Those input events are then injected into CEGUI in Lua.
    5360    */
    5461    class _OrxonoxExport GUIManager
     
    5966// tolua_end
    6067    public:
     68        /**
     69        @enum State
     70            The current state of the GUIManager. There should maybe be more (or we can omit this totally).
     71        */
    6172        enum State
    6273        {
    63             Uninitialised,
    64             Ready,
    65             OnDisplay
     74            Uninitialised,  //!< Initial state of the GUIManager
     75            Ready,          //!< State after initialisation if ready
     76            OnDisplay       //!< State if GUI is displayed
    6677        };
    6778
     
    7081
    7182        bool initialise(Ogre::RenderWindow* renderWindow);
    72         void loadScene(const std::string& name);
    73         void tick(float dt)
    74         {
    75             assert(guiSystem_);
    76             guiSystem_->injectTimePulse(dt);
    77         }
    78         void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
    79         void hideGUI(); // tolua_export
    8083
    81         Ogre::Camera* getCamera() { return this->backgroundCamera_; }
     84        void update(const Clock& time);
    8285
    83         static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground)
    84         {
    85             getInstance().showGUI(name, sceneManager);
    86         }
     86        void showGUI(const std::string& name);
     87        void executeCode(const std::string& str);
     88
     89        void setCamera(Ogre::Camera* camera);
    8790
    8891        static GUIManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
     
    9093
    9194    private:
    92         GUIManager(const GUIManager& instance);
     95        GUIManager(const GUIManager& instance);                 //!< private constructor (this is a singleton class)
    9396
     97        void loadLuaCode();
     98
     99        // keyHandler functions
    94100        void keyPressed (const KeyEvent& evt)
    95         { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); }
     101            { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); }
    96102        void keyReleased(const KeyEvent& evt)
    97         { guiSystem_->injectKeyUp(evt.key); }
    98         void keyHeld    (const KeyEvent& evt)
    99         { }
     103            { guiSystem_->injectKeyUp(evt.key); }
     104        void keyHeld    (const KeyEvent& evt) { }
    100105
     106        // mouseHandler functions
    101107        void mouseButtonPressed (MouseButtonCode::ByEnum id);
    102108        void mouseButtonReleased(MouseButtonCode::ByEnum id);
    103         void mouseButtonHeld    (MouseButtonCode::ByEnum id)
    104         { }
     109        void mouseButtonHeld    (MouseButtonCode::ByEnum id) { }
    105110        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
    106         { guiSystem_->injectMouseMove(rel.x, rel.y); }
     111            { guiSystem_->injectMouseMove(rel.x, rel.y); }
    107112        void mouseScrolled      (int abs, int rel)
    108         { guiSystem_->injectMouseWheelChange(rel);}
     113            { guiSystem_->injectMouseWheelChange(rel);}
    109114
    110         void tickInput(float dt) { }
    111         void tickKey(float dt) { }
    112         void tickMouse(float dt) { }
    113 
    114         void loadScenes();
    115 
    116         //Ogre::SceneManager*       emptySceneManager_;
    117         Ogre::SceneManager*       backgroundSceneManager_;
    118         //Ogre::Camera*             emptyCamera_;
    119         Ogre::Camera*             backgroundCamera_;
    120         //Ogre::Viewport*           viewport_;
    121         Ogre::RenderWindow*       renderWindow_;
    122         CEGUI::OgreCEGUIRenderer* guiRenderer_;
    123         CEGUI::ResourceProvider*  resourceProvider_;
    124         CEGUI::LuaScriptModule*   scriptModule_;
    125         CEGUI::DefaultLogger*     ceguiLogger_;
    126         CEGUI::System*            guiSystem_;
    127         CEGUI::Imageset*          backgroundImage_;
    128         lua_State*                luaState_;
    129 
    130         State state_;
     115        void updateInput(float dt)  { }
     116        void updateKey  (float dt)  { }
     117        void updateMouse(float dt)  { }
    131118
    132119        static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
    133120
    134         static GUIManager*        singletonRef_s;
     121        Ogre::RenderWindow*         renderWindow_;      //!< Ogre's render window to give CEGUI access to it
     122        CEGUI::OgreCEGUIRenderer*   guiRenderer_;       //!< CEGUI's interface to the Ogre Engine
     123        CEGUI::ResourceProvider*    resourceProvider_;  //!< CEGUI's resource provider
     124        CEGUI::LuaScriptModule*     scriptModule_;      //!< CEGUI's script module to use Lua
     125        CEGUI::DefaultLogger*       ceguiLogger_;       //!< CEGUI's logger to be able to log CEGUI errors in our log
     126        CEGUI::System*              guiSystem_;         //!< CEGUI's main system
     127        lua_State*                  luaState_;          //!< Lua state, access point to the Lua engine
     128
     129        State                       state_;             //!< reflects state of the GUIManager
     130
     131        static GUIManager*          singletonRef_s;     //!< Singleton reference to GUIManager
    135132    }; // tolua_export
    136133} // tolua_export
Note: See TracChangeset for help on using the changeset viewer.