| [1505] | 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 | */ | 
|---|
| [1137] | 28 |  | 
|---|
| [1505] | 29 | #ifndef _InGameConsole_H__ | 
|---|
|  | 30 | #define _InGameConsole_H__ | 
|---|
| [1137] | 31 |  | 
|---|
| [1505] | 32 |  | 
|---|
| [1137] | 33 | #include "OrxonoxPrereqs.h" | 
|---|
| [1143] | 34 |  | 
|---|
| [3196] | 35 | #include <string> | 
|---|
| [3370] | 36 |  | 
|---|
| [3196] | 37 | #include "util/OgreForwardRefs.h" | 
|---|
| [3370] | 38 | #include "util/Singleton.h" | 
|---|
| [3327] | 39 | #include "core/WindowEventListener.h" | 
|---|
| [7284] | 40 | #include "core/command/Shell.h" | 
|---|
| [10624] | 41 | #include "core/UpdateListener.h" | 
|---|
| [1505] | 42 |  | 
|---|
|  | 43 | namespace orxonox | 
|---|
| [1137] | 44 | { | 
|---|
| [10624] | 45 | class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener, public UpdateListener | 
|---|
| [1143] | 46 | { | 
|---|
| [3370] | 47 | friend class Singleton<InGameConsole>; | 
|---|
| [1755] | 48 | public: // functions | 
|---|
|  | 49 | InGameConsole(); | 
|---|
|  | 50 | ~InGameConsole(); | 
|---|
| [1502] | 51 |  | 
|---|
| [3327] | 52 | void initialise(); | 
|---|
| [1755] | 53 | void setConfigValues(); | 
|---|
| [1505] | 54 |  | 
|---|
| [6417] | 55 | void preUpdate(const Clock& time); | 
|---|
| [10624] | 56 | void postUpdate(const Clock& time) { /*no action*/ } | 
|---|
| [1577] | 57 |  | 
|---|
| [1755] | 58 | static void openConsole(); | 
|---|
|  | 59 | static void closeConsole(); | 
|---|
| [1505] | 60 |  | 
|---|
| [1755] | 61 | private: // functions | 
|---|
| [1879] | 62 | InGameConsole(const InGameConsole& other); | 
|---|
| [1540] | 63 |  | 
|---|
| [1755] | 64 | void activate(); | 
|---|
|  | 65 | void deactivate(); | 
|---|
| [1505] | 66 |  | 
|---|
| [1755] | 67 | void linesChanged(); | 
|---|
|  | 68 | void lineAdded(); | 
|---|
|  | 69 | void inputChanged(); | 
|---|
|  | 70 | void cursorChanged(); | 
|---|
| [6105] | 71 | void executed(); | 
|---|
| [1755] | 72 | void exit(); | 
|---|
| [1577] | 73 |  | 
|---|
| [1755] | 74 | void shiftLines(); | 
|---|
| [6417] | 75 | void colourLine(Shell::LineType type, int index); | 
|---|
| [1755] | 76 | void setCursorPosition(unsigned int pos); | 
|---|
| [6417] | 77 | void print(const std::string& text, Shell::LineType type, int index, bool alwaysShift = false); | 
|---|
| [1590] | 78 |  | 
|---|
| [2896] | 79 | void windowResized(unsigned int newWidth, unsigned int newHeight); | 
|---|
| [1505] | 80 |  | 
|---|
| [1878] | 81 | // config value related | 
|---|
|  | 82 | void bHidesAllInputChanged(); | 
|---|
|  | 83 |  | 
|---|
| [1755] | 84 | private: // variables | 
|---|
| [6105] | 85 | Shell* shell_; | 
|---|
| [1755] | 86 | bool bActive_; | 
|---|
|  | 87 | int windowW_; | 
|---|
|  | 88 | int windowH_; | 
|---|
|  | 89 | int desiredTextWidth_; | 
|---|
|  | 90 | unsigned int maxCharsPerLine_; | 
|---|
|  | 91 | unsigned int numLinesShifted_; | 
|---|
|  | 92 | int scroll_; | 
|---|
|  | 93 | float cursor_; | 
|---|
|  | 94 | unsigned int inputWindowStart_; | 
|---|
|  | 95 | bool bShowCursor_; | 
|---|
|  | 96 | std::string displayedText_; | 
|---|
|  | 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 |  | 
|---|
| [1878] | 104 | // input related | 
|---|
| [3327] | 105 | InputState* inputState_; | 
|---|
| [1878] | 106 |  | 
|---|
| [1755] | 107 | // config values | 
|---|
|  | 108 | float relativeWidth; | 
|---|
|  | 109 | float relativeHeight; | 
|---|
|  | 110 | float blinkTime; | 
|---|
|  | 111 | float scrollSpeed_; | 
|---|
|  | 112 | float noiseSize_; | 
|---|
|  | 113 | char cursorSymbol_; | 
|---|
| [1878] | 114 | bool bHidesAllInput_; | 
|---|
| [1755] | 115 |  | 
|---|
| [3370] | 116 | static InGameConsole* singletonPtr_s; | 
|---|
| [1505] | 117 | }; | 
|---|
|  | 118 | } | 
|---|
|  | 119 |  | 
|---|
|  | 120 | #endif /* _InGameConsole_H__ */ | 
|---|