Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/gui/GUIManager.h @ 2711

Last change on this file since 2711 was 2710, checked in by rgrieder, 16 years ago

Merged buildsystem3 containing buildsystem2 containing Adi's buildsystem branch back to the trunk.
Please update the media directory if you were not using buildsystem3 before.

  • Property svn:eol-style set to native
File size: 4.3 KB
RevLine 
[1638]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file
31    @brief Declaration of the GUIManager class.
32*/
33
34#ifndef _GUIManager_H__
35#define _GUIManager_H__
36
37#include "OrxonoxPrereqs.h"
38#include <OgrePrerequisites.h>
39#include <CEGUIForwardRefs.h>
40#include <CEGUIInputEvent.h>
41#include <CEGUISystem.h>
42#include "core/input/InputInterfaces.h"
43
[2710]44// Forward declaration
45namespace CEGUI { class DefaultLogger; }
46
47// tolua_begin
48namespace orxonox
49{
[1638]50    /**
51    @brief
52        Provides a simple interface to CEGUI with tolua methods and console commands
53    */
[2710]54    class _OrxonoxExport GUIManager
55// tolua_end
56        : public KeyHandler, public MouseHandler
57// tolua_begin
[1638]58    {
[2710]59// tolua_end
[1638]60    public:
61        enum State
62        {
63            Uninitialised,
64            Ready,
65            OnDisplay
66        };
67
[1646]68        GUIManager();
69        ~GUIManager();
70
[1686]71        bool initialise(Ogre::RenderWindow* renderWindow);
[1647]72        void tick(float dt)
73        {
74            assert(guiSystem_);
75            guiSystem_->injectTimePulse(dt);
76        }
[1640]77        void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
[1661]78        void hideGUI(); // tolua_export
[1638]79
[1640]80        Ogre::Camera* getCamera() { return this->backgroundCamera_; }
81
82        static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground)
[1638]83        {
[1640]84            getInstance().showGUI(name, sceneManager);
[1638]85        }
86
[1646]87        static GUIManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
88        static GUIManager* getInstancePtr() { return singletonRef_s; }
89
[1638]90    private:
91        GUIManager(const GUIManager& instance);
92
93        void keyPressed (const KeyEvent& evt)
94        { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); }
95        void keyReleased(const KeyEvent& evt)
96        { guiSystem_->injectKeyUp(evt.key); }
97        void keyHeld    (const KeyEvent& evt)
98        { }
99
[1887]100        void mouseButtonPressed (MouseButtonCode::ByEnum id);
101        void mouseButtonReleased(MouseButtonCode::ByEnum id);
102        void mouseButtonHeld    (MouseButtonCode::ByEnum id)
[1638]103        { }
104        void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
105        { guiSystem_->injectMouseMove(rel.x, rel.y); }
106        void mouseScrolled      (int abs, int rel)
107        { guiSystem_->injectMouseWheelChange(rel);}
108
109        void tickInput(float dt) { }
[1641]110        void tickKey(float dt) { }
111        void tickMouse(float dt) { }
[1638]112
113        void loadScenes();
114
[1640]115        //Ogre::SceneManager*       emptySceneManager_;
[1638]116        Ogre::SceneManager*       backgroundSceneManager_;
[1640]117        //Ogre::Camera*             emptyCamera_;
[1638]118        Ogre::Camera*             backgroundCamera_;
[1640]119        //Ogre::Viewport*           viewport_;
[1638]120        Ogre::RenderWindow*       renderWindow_;
121        CEGUI::OgreCEGUIRenderer* guiRenderer_;
122        CEGUI::ResourceProvider*  resourceProvider_;
123        CEGUI::LuaScriptModule*   scriptModule_;
[2710]124        CEGUI::DefaultLogger*     ceguiLogger_;
[1638]125        CEGUI::System*            guiSystem_;
126        CEGUI::Imageset*          backgroundImage_;
[1646]127        lua_State*                luaState_;
[1638]128
129        State state_;
130
[1887]131        static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
[1638]132
[1646]133        static GUIManager*        singletonRef_s;
[1638]134    }; // tolua_export
135} // tolua_export
136
137#endif /* _GUIManager_H__ */
Note: See TracBrowser for help on using the repository browser.