Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pch/src/orxonox/overlays/console/InGameConsole.h @ 3143

Last change on this file since 3143 was 3142, checked in by rgrieder, 15 years ago

Move std::string to Ogre::UTFString conversion to util.

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
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 *      Felix Schulthess
24 *   Co-authors:
25 *      Fabian 'x3n' Landau
26 *
27 */
28
29#ifndef _InGameConsole_H__
30#define _InGameConsole_H__
31
32
33#include "OrxonoxPrereqs.h"
34#include <OgrePrerequisites.h>
35#include <OgreBorderPanelOverlayElement.h>
36#include <OgreTextAreaOverlayElement.h>
37
38#include "core/Shell.h"
39#include "core/OrxonoxClass.h"
40#include "tools/WindowEventListener.h"
41
42
43namespace orxonox
44{
45    class _OrxonoxExport InGameConsole : virtual public OrxonoxClass, public ShellListener, public WindowEventListener
46    {
47    public: // functions
48        InGameConsole();
49        ~InGameConsole();
50
51        void initialise(int windowWidth, int windowHeight);
52        void destroy();
53        void setConfigValues();
54
55        void update(const Clock& time);
56
57        static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
58        static InGameConsole* getInstancePtr() { return singletonRef_s; }
59
60        static void openConsole();
61        static void closeConsole();
62
63    private: // functions
64        InGameConsole(const InGameConsole& other);
65
66        void activate();
67        void deactivate();
68
69        void linesChanged();
70        void onlyLastLineChanged();
71        void lineAdded();
72        void inputChanged();
73        void cursorChanged();
74        void exit();
75
76        void shiftLines();
77        void colourLine(int colourcode, int index);
78        void setCursorPosition(unsigned int pos);
79        void print(const std::string& text, int index, bool alwaysShift = false);
80
81        void windowResized(unsigned int newWidth, unsigned int newHeight);
82
83        // config value related
84        void bHidesAllInputChanged();
85
86    private: // variables
87        bool bActive_;
88        int windowW_;
89        int windowH_;
90        int desiredTextWidth_;
91        unsigned int maxCharsPerLine_;
92        unsigned int numLinesShifted_;
93        int scroll_;
94        float cursor_;
95        unsigned int inputWindowStart_;
96        bool bShowCursor_;
97        std::string displayedText_;
98        Ogre::Overlay* consoleOverlay_;
99        Ogre::OverlayContainer* consoleOverlayContainer_;
100        Ogre::PanelOverlayElement* consoleOverlayNoise_;
101        Ogre::TextAreaOverlayElement* consoleOverlayCursor_;
102        Ogre::BorderPanelOverlayElement* consoleOverlayBorder_;
103        Ogre::TextAreaOverlayElement** consoleOverlayTextAreas_;
104
105        // input related
106        SimpleInputState* inputState_;
107
108        // config values
109        float relativeWidth;
110        float relativeHeight;
111        float blinkTime;
112        float scrollSpeed_;
113        float noiseSize_;
114        char cursorSymbol_;
115        bool bHidesAllInput_;
116
117        static InGameConsole* singletonRef_s;
118    };
119}
120
121#endif /* _InGameConsole_H__ */
Note: See TracBrowser for help on using the repository browser.