/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * Felix Schulthess * Co-authors: * Fabian 'x3n' Landau * */ #ifndef _InGameConsole_H__ #define _InGameConsole_H__ #include "OrxonoxPrereqs.h" #include #include "util/OgreForwardRefs.h" #include "util/Singleton.h" #include "core/WindowEventListener.h" #include "core/command/Shell.h" #include "core/UpdateListener.h" namespace orxonox { class _OrxonoxExport InGameConsole : public Singleton, public ShellListener, public WindowEventListener, public UpdateListener { friend class Singleton; public: // functions InGameConsole(); ~InGameConsole(); void initialise(); void setConfigValues(); virtual void preUpdate(const Clock& time) override; virtual void postUpdate(const Clock& time) override { /*no action*/ } static void openConsole(); static void closeConsole(); private: // functions InGameConsole(const InGameConsole& other); void activate(); void deactivate(); virtual void linesChanged() override; virtual void lineAdded() override; virtual void inputChanged() override; virtual void cursorChanged() override; virtual void executed() override; virtual void exit() override; void shiftLines(); void colourLine(Shell::LineType type, int index); void setCursorPosition(unsigned int pos); void print(const std::string& text, Shell::LineType type, int index, bool alwaysShift = false); virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override; // config value related void bHidesAllInputChanged(); private: // variables Shell* shell_; bool bActive_; int windowW_; int windowH_; int desiredTextWidth_; unsigned int maxCharsPerLine_; unsigned int numLinesShifted_; int scroll_; float cursor_; unsigned int inputWindowStart_; bool bShowCursor_; std::string displayedText_; Ogre::Overlay* consoleOverlay_; Ogre::OverlayContainer* consoleOverlayContainer_; Ogre::PanelOverlayElement* consoleOverlayNoise_; Ogre::TextAreaOverlayElement* consoleOverlayCursor_; Ogre::BorderPanelOverlayElement* consoleOverlayBorder_; Ogre::TextAreaOverlayElement** consoleOverlayTextAreas_; // input related InputState* inputState_; // config values float relativeWidth; float relativeHeight; float blinkTime; float scrollSpeed_; float noiseSize_; char cursorSymbol_; bool bHidesAllInput_; static InGameConsole* singletonPtr_s; }; } #endif /* _InGameConsole_H__ */