[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" |
---|
| 34 | #include <OgrePrerequisites.h> |
---|
| 35 | #include <OgreBorderPanelOverlayElement.h> |
---|
| 36 | #include <OgreTextAreaOverlayElement.h> |
---|
[1143] | 37 | |
---|
[1502] | 38 | #include "core/Shell.h" |
---|
[1755] | 39 | #include "core/OrxonoxClass.h" |
---|
[1590] | 40 | #include "tools/WindowEventListener.h" |
---|
[1505] | 41 | |
---|
| 42 | |
---|
| 43 | namespace orxonox |
---|
[1137] | 44 | { |
---|
[1755] | 45 | class _OrxonoxExport InGameConsole : virtual public OrxonoxClass, public ShellListener, public WindowEventListener |
---|
[1143] | 46 | { |
---|
[1755] | 47 | public: // functions |
---|
| 48 | InGameConsole(); |
---|
| 49 | ~InGameConsole(); |
---|
[1502] | 50 | |
---|
[2087] | 51 | void initialise(int windowWidth, int windowHeight); |
---|
[1755] | 52 | void destroy(); |
---|
| 53 | void setConfigValues(); |
---|
[1505] | 54 | |
---|
[2908] | 55 | virtual void tick(float dt); |
---|
[1577] | 56 | |
---|
[1755] | 57 | static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; } |
---|
| 58 | static InGameConsole* getInstancePtr() { return singletonRef_s; } |
---|
[1137] | 59 | |
---|
[1755] | 60 | static void openConsole(); |
---|
| 61 | static void closeConsole(); |
---|
[1505] | 62 | |
---|
[2087] | 63 | static Ogre::UTFString convert2UTF(const std::string& text); |
---|
| 64 | |
---|
[1755] | 65 | private: // functions |
---|
[1879] | 66 | InGameConsole(const InGameConsole& other); |
---|
[1540] | 67 | |
---|
[1755] | 68 | void activate(); |
---|
| 69 | void deactivate(); |
---|
[1505] | 70 | |
---|
[1755] | 71 | void linesChanged(); |
---|
| 72 | void onlyLastLineChanged(); |
---|
| 73 | void lineAdded(); |
---|
| 74 | void inputChanged(); |
---|
| 75 | void cursorChanged(); |
---|
| 76 | void exit(); |
---|
[1577] | 77 | |
---|
[1755] | 78 | void shiftLines(); |
---|
| 79 | void colourLine(int colourcode, int index); |
---|
| 80 | void setCursorPosition(unsigned int pos); |
---|
| 81 | void print(const std::string& text, int index, bool alwaysShift = false); |
---|
[1590] | 82 | |
---|
[2908] | 83 | void windowResized(int newWidth, int newHeight); |
---|
[1505] | 84 | |
---|
[1878] | 85 | // config value related |
---|
| 86 | void bHidesAllInputChanged(); |
---|
| 87 | |
---|
[1755] | 88 | private: // variables |
---|
| 89 | bool bActive_; |
---|
| 90 | int windowW_; |
---|
| 91 | int windowH_; |
---|
| 92 | int desiredTextWidth_; |
---|
| 93 | unsigned int maxCharsPerLine_; |
---|
| 94 | unsigned int numLinesShifted_; |
---|
| 95 | int scroll_; |
---|
| 96 | float cursor_; |
---|
| 97 | unsigned int inputWindowStart_; |
---|
| 98 | bool bShowCursor_; |
---|
| 99 | std::string displayedText_; |
---|
| 100 | Ogre::Overlay* consoleOverlay_; |
---|
| 101 | Ogre::OverlayContainer* consoleOverlayContainer_; |
---|
| 102 | Ogre::PanelOverlayElement* consoleOverlayNoise_; |
---|
| 103 | Ogre::TextAreaOverlayElement* consoleOverlayCursor_; |
---|
| 104 | Ogre::BorderPanelOverlayElement* consoleOverlayBorder_; |
---|
| 105 | Ogre::TextAreaOverlayElement** consoleOverlayTextAreas_; |
---|
| 106 | |
---|
[1878] | 107 | // input related |
---|
| 108 | SimpleInputState* inputState_; |
---|
| 109 | |
---|
[1755] | 110 | // config values |
---|
| 111 | float relativeWidth; |
---|
| 112 | float relativeHeight; |
---|
| 113 | float blinkTime; |
---|
| 114 | float scrollSpeed_; |
---|
| 115 | float noiseSize_; |
---|
| 116 | char cursorSymbol_; |
---|
[1878] | 117 | bool bHidesAllInput_; |
---|
[1755] | 118 | |
---|
| 119 | static InGameConsole* singletonRef_s; |
---|
[1505] | 120 | }; |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | #endif /* _InGameConsole_H__ */ |
---|