Orxonox  0.0.5 Codename: Arcturus
InGameConsole.h
Go to the documentation of this file.
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 
35 #include <string>
36 
37 #include "util/OgreForwardRefs.h"
38 #include "util/Singleton.h"
40 #include "core/command/Shell.h"
41 #include "core/UpdateListener.h"
42 
43 namespace orxonox
44 {
45  class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener, public UpdateListener
46  {
47  friend class Singleton<InGameConsole>;
48  public: // functions
49  InGameConsole();
50  ~InGameConsole();
51 
52  void initialise();
53  void setConfigValues();
54 
55  virtual void preUpdate(const Clock& time) override;
56  virtual void postUpdate(const Clock& time) override { /*no action*/ }
57 
58  static void openConsole();
59  static void closeConsole();
60 
61  private: // functions
62  InGameConsole(const InGameConsole& other);
63 
64  void activate();
65  void deactivate();
66 
67  virtual void linesChanged() override;
68  virtual void lineAdded() override;
69  virtual void inputChanged() override;
70  virtual void cursorChanged() override;
71  virtual void executed() override;
72  virtual void exit() override;
73 
74  void shiftLines();
75  void colourLine(Shell::LineType type, int index);
76  void setCursorPosition(unsigned int pos);
77  void print(const std::string& text, Shell::LineType type, int index, bool alwaysShift = false);
78 
79  virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
80 
81  // config value related
82  void bHidesAllInputChanged();
83 
84  private: // variables
86  bool bActive_;
87  int windowW_;
88  int windowH_;
90  unsigned int maxCharsPerLine_;
91  unsigned int numLinesShifted_;
92  int scroll_;
93  float cursor_;
94  unsigned int inputWindowStart_;
97  Ogre::Overlay* consoleOverlay_;
98  Ogre::OverlayContainer* consoleOverlayContainer_;
99  Ogre::PanelOverlayElement* consoleOverlayNoise_;
100  Ogre::TextAreaOverlayElement* consoleOverlayCursor_;
101  Ogre::BorderPanelOverlayElement* consoleOverlayBorder_;
102  Ogre::TextAreaOverlayElement** consoleOverlayTextAreas_;
103 
104  // input related
106 
107  // config values
110  float blinkTime;
112  float noiseSize_;
115 
117  };
118 }
119 
120 #endif /* _InGameConsole_H__ */
float scrollSpeed_
Definition: InGameConsole.h:111
bool bShowCursor_
Definition: InGameConsole.h:95
unsigned int numLinesShifted_
Definition: InGameConsole.h:91
int windowW_
Definition: InGameConsole.h:87
::std::string string
Definition: gtest-port.h:756
Inherit from UpdateListener if you need to receive calls before or after the game is ticked...
Definition: UpdateListener.h:52
int desiredTextWidth_
Definition: InGameConsole.h:89
Interface for receiving window events like resize, moved and focusChanged.
Definition: WindowEventListener.h:43
Ogre::OverlayContainer * consoleOverlayContainer_
Definition: InGameConsole.h:98
float blinkTime
Definition: InGameConsole.h:110
bool bHidesAllInput_
Definition: InGameConsole.h:114
unsigned int inputWindowStart_
Definition: InGameConsole.h:94
The Shell is the logical component of the console that displays output to the user and allows him to ...
Definition: Shell.h:86
int scroll_
Definition: InGameConsole.h:92
Ogre::PanelOverlayElement * consoleOverlayNoise_
Definition: InGameConsole.h:99
virtual void postUpdate(const Clock &time) override
Gets called by Core after the framework was ticked (but before graphics are drawn).
Definition: InGameConsole.h:56
InputState * inputState_
Definition: InGameConsole.h:105
Base for singleton classes.
Definition: Singleton.h:114
int windowH_
Definition: InGameConsole.h:88
float relativeWidth
Definition: InGameConsole.h:108
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Shared library macros, enums, constants and forward declarations for the orxonox library ...
char cursorSymbol_
Definition: InGameConsole.h:113
bool bActive_
Definition: InGameConsole.h:86
Ogre::Overlay * consoleOverlay_
Definition: InGameConsole.h:97
Definition: InGameConsole.h:45
float relativeHeight
Definition: InGameConsole.h:109
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
InputStates allow you to customise the input event targets at runtime.
Definition: InputState.h:83
Definition of the Singleton template that is used as base class for classes that allow only one insta...
Shell * shell_
Definition: InGameConsole.h:85
float noiseSize_
Definition: InGameConsole.h:112
Simple real time clock based on Ogre::Timer.
Definition: Clock.h:57
Ogre::TextAreaOverlayElement ** consoleOverlayTextAreas_
Definition: InGameConsole.h:102
LineType
Defines the type of a line of text in the Shell - some types depend on the output level...
Definition: Shell.h:90
Ogre::TextAreaOverlayElement * consoleOverlayCursor_
Definition: InGameConsole.h:100
Ogre::BorderPanelOverlayElement * consoleOverlayBorder_
Definition: InGameConsole.h:101
std::string displayedText_
Definition: InGameConsole.h:96
float cursor_
Definition: InGameConsole.h:93
An interface, used to get a notification if the state of the Shell changes.
Definition: Shell.h:58
Declaration of the Shell and ShellListener classes.
unsigned int maxCharsPerLine_
Definition: InGameConsole.h:90
static InGameConsole * singletonPtr_s
Definition: InGameConsole.h:116