Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/overlays/InGameConsole.cc @ 8774

Last change on this file since 8774 was 8729, checked in by rgrieder, 13 years ago

Merged unity_build branch back to trunk.

Features:

  • Implemented fully automatic build units to speed up compilation if requested
  • Added DOUT macro for quick debug output
  • Activated text colouring in the POSIX IOConsole
  • DeclareToluaInterface is not necessary anymore

Improvements:

  • Output levels now change appropriately when switch back and forth from dev mode
  • Log level for the file output is now also correct during startup
  • Removed some header file dependencies in core and tools to speed up compilation

no more file for command line options

  • Improved util::tribool by adapting some concepts from boost::tribool

Regressions:

  • It is not possible anymore to specify command line arguments in an extra file because we've got config values for that purpose.
  • Property svn:eol-style set to native
File size: 23.9 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
30#include "InGameConsole.h"
31
32#include <algorithm>
33#include <string>
34#include <OgreOverlay.h>
35#include <OgreOverlayElement.h>
36#include <OgreOverlayManager.h>
37#include <OgreOverlayContainer.h>
38#include <OgreBorderPanelOverlayElement.h>
39#include <OgreTextAreaOverlayElement.h>
40#include <OgreFontManager.h>
41#include <OgreFont.h>
42
43#include "util/Clock.h"
44#include "util/Convert.h"
45#include "util/Math.h"
46#include "util/DisplayStringConversions.h"
47#include "util/ScopedSingletonManager.h"
48#include "core/CoreIncludes.h"
49#include "core/ConfigValueIncludes.h"
50#include "core/command/ConsoleCommand.h"
51#include "core/GUIManager.h"
52#include "core/input/InputManager.h"
53#include "core/input/InputState.h"
54#include "core/input/InputBuffer.h"
55#include "core/LuaState.h"
56
57namespace orxonox
58{
59    const int LINES = 30;
60    const float CHAR_WIDTH = 7.45f; // fix this please - determine the char-width dynamically
61
62    SetConsoleCommand("InGameConsole", "openConsole", &InGameConsole::openConsole);
63    SetConsoleCommand("InGameConsole", "closeConsole", &InGameConsole::closeConsole);
64
65    ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false);
66
67    /**
68        @brief Constructor: Creates and initializes the InGameConsole.
69    */
70    InGameConsole::InGameConsole()
71        : shell_(new Shell("InGameConsole", true))
72        , bShowCursor_(false)
73        , consoleOverlay_(0)
74        , consoleOverlayContainer_(0)
75        , consoleOverlayNoise_(0)
76        , consoleOverlayCursor_(0)
77        , consoleOverlayBorder_(0)
78        , consoleOverlayTextAreas_(0)
79        , inputState_(0)
80    {
81        RegisterObject(InGameConsole);
82
83        this->bActive_ = false;
84        this->cursor_ = 0.0f;
85        this->cursorSymbol_ = '|';
86        this->inputWindowStart_ = 0;
87        this->numLinesShifted_ = LINES - 1;
88        // for the beginning, don't scroll
89        this->scroll_ = 0;
90
91        this->setConfigValues();
92        this->initialise();
93
94        // Output buffering is not anymore needed. Not the best solution to do
95        // this here, but there isn't much of another way.
96        OutputHandler::getInstance().disableMemoryLog();
97    }
98
99    /**
100        @brief Destructor: Destroys the TextAreas.
101    */
102    InGameConsole::~InGameConsole()
103    {
104        this->deactivate();
105
106        // destroy the input state previously created (InputBuffer gets destroyed by the Shell)
107        InputManager::getInstance().destroyState("console");
108
109        // destroy the underlaying shell
110        this->shell_->destroy();
111
112        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
113        if (ovMan)
114        {
115            if (this->consoleOverlayNoise_)
116                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayNoise_);
117            if (this->consoleOverlayCursor_)
118                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayCursor_);
119            Ogre::FontManager::getSingleton().remove("MonofurConsole");
120            if (this->consoleOverlayBorder_)
121                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayBorder_);
122            if (this->consoleOverlayTextAreas_)
123            {
124                for (int i = 0; i < LINES; i++)
125                {
126                    if (this->consoleOverlayTextAreas_[i])
127                        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayTextAreas_[i]);
128                    this->consoleOverlayTextAreas_[i] = 0;
129                }
130
131            }
132            if (this->consoleOverlayContainer_)
133                Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayContainer_);
134        }
135        if (this->consoleOverlayTextAreas_)
136        {
137            delete[] this->consoleOverlayTextAreas_;
138            this->consoleOverlayTextAreas_ = 0;
139        }
140
141        if (this->consoleOverlay_)
142            Ogre::OverlayManager::getSingleton().destroy(consoleOverlay_);
143    }
144
145    /**
146        @brief Sets the config values, describing the size of the console.
147    */
148    void InGameConsole::setConfigValues()
149    {
150        SetConfigValue(relativeWidth, 0.8);
151        SetConfigValue(relativeHeight, 0.4);
152        SetConfigValue(blinkTime, 0.5);
153        SetConfigValue(scrollSpeed_, 3.0f);
154        SetConfigValue(noiseSize_, 1.0f);
155        SetConfigValue(cursorSymbol_, '|');
156        SetConfigValue(bHidesAllInput_, false).callback(this, &InGameConsole::bHidesAllInputChanged);
157    }
158
159    /**
160        @brief Called whenever bHidesAllInput_ changes.
161    */
162    void InGameConsole::bHidesAllInputChanged()
163    {
164        if (inputState_)
165        {
166            if (bHidesAllInput_)
167            {
168                inputState_->setMouseHandler(&InputHandler::EMPTY);
169                inputState_->setJoyStickHandler(&InputHandler::EMPTY);
170            }
171            else
172            {
173                inputState_->setMouseHandler(0);
174                inputState_->setJoyStickHandler(0);
175            }
176        }
177    }
178
179    /**
180        @brief Initializes the InGameConsole.
181    */
182    void InGameConsole::initialise()
183    {
184        // create the corresponding input state
185        inputState_ = InputManager::getInstance().createInputState("console", false, false, InputStatePriority::Console);
186        inputState_->setKeyHandler(this->shell_->getInputBuffer());
187        bHidesAllInputChanged();
188
189        // create overlay and elements
190        Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
191
192        // create actual overlay
193        this->consoleOverlay_ = ovMan->create("InGameConsoleConsole");
194
195        // create a container
196        this->consoleOverlayContainer_ = static_cast<Ogre::OverlayContainer*>(ovMan->createOverlayElement("Panel", "InGameConsoleContainer"));
197        this->consoleOverlayContainer_->setMetricsMode(Ogre::GMM_RELATIVE);
198        this->consoleOverlayContainer_->setPosition((1 - this->relativeWidth) / 2, 0);
199        this->consoleOverlayContainer_->setDimensions(this->relativeWidth, this->relativeHeight);
200        this->consoleOverlay_->add2D(this->consoleOverlayContainer_);
201
202        // create BorderPanel
203        this->consoleOverlayBorder_ = static_cast<Ogre::BorderPanelOverlayElement*>(ovMan->createOverlayElement("BorderPanel", "InGameConsoleBorderPanel"));
204        this->consoleOverlayBorder_->setMetricsMode(Ogre::GMM_PIXELS);
205        this->consoleOverlayBorder_->setMaterialName("ConsoleCenter");
206        this->consoleOverlayBorder_->setBorderSize(16, 16, 0, 16);
207        this->consoleOverlayBorder_->setBorderMaterialName("ConsoleBorder");
208        this->consoleOverlayBorder_->setLeftBorderUV(0.0f, 0.49f, 0.5f, 0.51f);
209        this->consoleOverlayBorder_->setRightBorderUV(0.5f, 0.49f, 1.0f, 0.5f);
210        this->consoleOverlayBorder_->setBottomBorderUV(0.49f, 0.5f, 0.51f, 1.0f);
211        this->consoleOverlayBorder_->setBottomLeftBorderUV(0.0f, 0.5f, 0.5f, 1.0f);
212        this->consoleOverlayBorder_->setBottomRightBorderUV(0.5f, 0.5f, 1.0f, 1.0f);
213        this->consoleOverlayContainer_->addChild(this->consoleOverlayBorder_);
214
215        // create a new font to match the requested size exactly
216        Ogre::FontPtr font = static_cast<Ogre::FontPtr>
217            (Ogre::FontManager::getSingleton().create("MonofurConsole", "General"));
218        font->setType(Ogre::FT_TRUETYPE);
219        font->setSource("Monofur.ttf");
220        font->setTrueTypeSize(18);
221        // reto: I don't know why, but setting the resolution twice as high makes the font look a lot clearer
222        font->setTrueTypeResolution(192);
223        font->addCodePointRange(Ogre::Font::CodePointRange(33, 126));
224        font->addCodePointRange(Ogre::Font::CodePointRange(161, 255));
225
226        // create noise
227        this->consoleOverlayNoise_ = static_cast<Ogre::PanelOverlayElement*>(ovMan->createOverlayElement("Panel", "InGameConsoleNoise"));
228        this->consoleOverlayNoise_->setMetricsMode(Ogre::GMM_PIXELS);
229        this->consoleOverlayNoise_->setPosition(5,0);
230        this->consoleOverlayNoise_->setMaterialName("ConsoleNoiseSmall");
231        // comment following line to disable noise
232        this->consoleOverlayBorder_->addChild(this->consoleOverlayNoise_);
233
234        // create the text lines
235        this->consoleOverlayTextAreas_ = new Ogre::TextAreaOverlayElement*[LINES];
236        for (int i = 0; i < LINES; i++)
237        {
238            this->consoleOverlayTextAreas_[i] = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "InGameConsoleTextArea" + multi_cast<std::string>(i)));
239            this->consoleOverlayTextAreas_[i]->setMetricsMode(Ogre::GMM_PIXELS);
240            this->consoleOverlayTextAreas_[i]->setFontName("MonofurConsole");
241            this->consoleOverlayTextAreas_[i]->setCharHeight(18);
242            this->consoleOverlayTextAreas_[i]->setParameter("colour_top", "0.21 0.69 0.21");
243            this->consoleOverlayTextAreas_[i]->setLeft(8);
244            this->consoleOverlayTextAreas_[i]->setCaption("");
245            this->consoleOverlayNoise_->addChild(this->consoleOverlayTextAreas_[i]);
246        }
247
248        // create cursor (also a text area overlay element)
249        this->consoleOverlayCursor_ = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "InGameConsoleCursor"));
250        this->consoleOverlayCursor_->setMetricsMode(Ogre::GMM_PIXELS);
251        this->consoleOverlayCursor_->setFontName("MonofurConsole");
252        this->consoleOverlayCursor_->setCharHeight(18);
253        this->consoleOverlayCursor_->setParameter("colour_top", "0.21 0.69 0.21");
254        this->consoleOverlayCursor_->setLeft(7);
255        this->consoleOverlayCursor_->setCaption(std::string(this->cursorSymbol_, 1));
256        this->consoleOverlayNoise_->addChild(this->consoleOverlayCursor_);
257
258        this->windowResized(this->getWindowWidth(), this->getWindowWidth());
259
260        // move overlay "above" the top edge of the screen
261        // we take -1.3 because the border makes the panel bigger
262        this->consoleOverlayContainer_->setTop(-1.3f * this->relativeHeight);
263
264        COUT(4) << "Info: InGameConsole initialized" << std::endl;
265    }
266
267    // ###############################
268    // ###  ShellListener methods  ###
269    // ###############################
270
271    /**
272        @brief Called if all output-lines have to be redrawn.
273    */
274    void InGameConsole::linesChanged()
275    {
276        Shell::LineList::const_iterator it = this->shell_->getNewestLineIterator();
277        int max = 0;
278        for (int i = 1; i < LINES; ++i)
279        {
280            if (it != this->shell_->getEndIterator())
281            {
282                ++it;
283                max = i;
284            }
285            else
286                break;
287        }
288
289        for (int i = LINES - 1; i > max; --i)
290            this->print("", Shell::None, i, true);
291
292        for (int i = max; i >= 1; --i)
293        {
294            --it;
295            this->print(it->first, it->second, i, true);
296        }
297    }
298
299    /**
300        @brief Called if only the last output-line has changed.
301    */
302    void InGameConsole::onlyLastLineChanged()
303    {
304        if (LINES > 1)
305            this->print(this->shell_->getNewestLineIterator()->first, this->shell_->getNewestLineIterator()->second, 1);
306    }
307
308    /**
309        @brief Called if a new output-line was added.
310    */
311    void InGameConsole::lineAdded()
312    {
313        this->numLinesShifted_ = 0;
314        this->shiftLines();
315        this->onlyLastLineChanged();
316    }
317
318    /**
319        @brief Called if the text in the input-line has changed.
320    */
321    void InGameConsole::inputChanged()
322    {
323        if (LINES > 0)
324            this->print(this->shell_->getInput(), Shell::Input, 0);
325
326        if (this->shell_->getInput().empty())
327            this->inputWindowStart_ = 0;
328    }
329
330    /**
331        @brief Called if the position of the cursor in the input-line has changed.
332    */
333    void InGameConsole::cursorChanged()
334    {
335        unsigned int pos = this->shell_->getCursorPosition() - inputWindowStart_;
336        if (pos > maxCharsPerLine_)
337            pos = maxCharsPerLine_;
338
339        this->consoleOverlayCursor_->setCaption(std::string(pos,' ') + cursorSymbol_);
340        this->consoleOverlayCursor_->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24.0f);
341    }
342
343    /**
344        @brief Called if a command is about to be executed
345    */
346    void InGameConsole::executed()
347    {
348        this->shell_->addOutput(this->shell_->getInput() + '\n', Shell::Command);
349    }
350
351    /**
352        @brief Called if the console gets closed.
353    */
354    void InGameConsole::exit()
355    {
356        this->deactivate();
357    }
358
359    // ###############################
360    // ###  other external calls   ###
361    // ###############################
362
363    /**
364        @brief Used to control the actual scrolling and the cursor.
365    */
366    void InGameConsole::preUpdate(const Clock& time)
367    {
368        if (this->scroll_ != 0)
369        {
370            float oldTop = this->consoleOverlayContainer_->getTop();
371
372            if (this->scroll_ > 0)
373            {
374                // scrolling down
375                // enlarge oldTop a little bit so that this exponential function
376                // reaches 0 before infinite time has passed...
377                float deltaScroll = (oldTop - 0.01f) * time.getDeltaTime() * this->scrollSpeed_;
378                if (oldTop - deltaScroll >= 0)
379                {
380                    // window has completely scrolled down
381                    this->consoleOverlayContainer_->setTop(0);
382                    this->scroll_ = 0;
383                }
384                else
385                    this->consoleOverlayContainer_->setTop(oldTop - deltaScroll);
386            }
387
388            else
389            {
390                // scrolling up
391                // note: +0.01 for the same reason as when scrolling down
392                float deltaScroll = (1.3f * this->relativeHeight + 0.01f + oldTop) * time.getDeltaTime() * this->scrollSpeed_;
393                if (oldTop - deltaScroll <= -1.3 * this->relativeHeight)
394                {
395                    // window has completely scrolled up
396                    this->consoleOverlayContainer_->setTop(-1.3f * this->relativeHeight);
397                    this->scroll_ = 0;
398                    this->consoleOverlay_->hide();
399                }
400                else
401                    this->consoleOverlayContainer_->setTop(oldTop - deltaScroll);
402            }
403        }
404
405        if (this->bActive_)
406        {
407            this->cursor_ += time.getDeltaTime();
408            if (this->cursor_ >= this->blinkTime)
409            {
410                this->cursor_ = 0;
411                bShowCursor_ = !bShowCursor_;
412                if (bShowCursor_)
413                    this->consoleOverlayCursor_->show();
414                else
415                    this->consoleOverlayCursor_->hide();
416            }
417
418            // this creates a flickering effect (extracts exactly 80% of the texture at a random location)
419            float uRand = (rand() & 1023) / 1023.0f * 0.2f;
420            float vRand = (rand() & 1023) / 1023.0f * 0.2f;
421            this->consoleOverlayNoise_->setUV(uRand, vRand, 0.8f + uRand, 0.8f + vRand);
422        }
423    }
424
425    /**
426        @brief Resizes the console elements. Call if window size changes.
427    */
428    void InGameConsole::windowResized(unsigned int newWidth, unsigned int newHeight)
429    {
430        this->windowW_ = newWidth;
431        this->windowH_ = newHeight;
432        this->consoleOverlayBorder_->setWidth((float)(int)(this->windowW_* this->relativeWidth));
433        this->consoleOverlayBorder_->setHeight((float)(int)(this->windowH_ * this->relativeHeight));
434        this->consoleOverlayNoise_->setWidth((float)(int)(this->windowW_ * this->relativeWidth) - 10.0f);
435        this->consoleOverlayNoise_->setHeight((float)(int)(this->windowH_ * this->relativeHeight) - 5.0f);
436        this->consoleOverlayNoise_->setTiling(consoleOverlayNoise_->getWidth() / (50.0f * this->noiseSize_), consoleOverlayNoise_->getHeight() / (50.0f * this->noiseSize_));
437
438        // now adjust the text lines...
439        this->desiredTextWidth_ = static_cast<int>(this->windowW_ * this->relativeWidth) - 12;
440
441        if (LINES > 0)
442            this->maxCharsPerLine_ = std::max(10U, static_cast<unsigned int>(static_cast<float>(this->desiredTextWidth_) / CHAR_WIDTH));
443        else
444            this->maxCharsPerLine_ = 10;
445
446        for (int i = 0; i < LINES; i++)
447        {
448            this->consoleOverlayTextAreas_[i]->setWidth((float)this->desiredTextWidth_);
449            this->consoleOverlayTextAreas_[i]->setTop((float)(int)(this->windowH_ * this->relativeHeight) - 24 - 14*i);
450        }
451
452        this->linesChanged();
453        this->cursorChanged();
454    }
455
456    // ###############################
457    // ###    internal methods     ###
458    // ###############################
459
460    /**
461        @brief Prints string to bottom line.
462        @param text The string to be printed
463        @param type The type of the text, defines the color
464        @param index The index of the text overlay in which the string will be displayed
465        @param alwaysShift If true the ohter lines in the console are always shifted by one line
466    */
467    void InGameConsole::print(const std::string& text, Shell::LineType type, int index, bool alwaysShift)
468    {
469        std::string output = text;
470        if (LINES > index)
471        {
472            this->colourLine(type, index);
473
474            if (index > 0)
475            {
476                unsigned int linesUsed = 1;
477                while (output.size() > this->maxCharsPerLine_)
478                {
479                    ++linesUsed;
480                    this->consoleOverlayTextAreas_[index]->setCaption(multi_cast<Ogre::DisplayString>(output.substr(0, this->maxCharsPerLine_)));
481                    output.erase(0, this->maxCharsPerLine_);
482                    output.insert(0, 1, ' ');
483                    if (linesUsed > numLinesShifted_ || alwaysShift)
484                        this->shiftLines();
485                    this->colourLine(type, index);
486                }
487                this->consoleOverlayTextAreas_[index]->setCaption(multi_cast<Ogre::DisplayString>(output));
488                this->displayedText_ = output;
489                this->numLinesShifted_ = linesUsed;
490            }
491            else
492            {
493                if (output.size() > this->maxCharsPerLine_)
494                {
495                    if (this->shell_->getInputBuffer()->getCursorPosition() < this->inputWindowStart_)
496                        this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition();
497                    else if (this->shell_->getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))
498                        this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1;
499
500                    output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_);
501                }
502                else
503                    this->inputWindowStart_ = 0;
504                this->displayedText_ = output;
505                this->consoleOverlayTextAreas_[index]->setCaption(multi_cast<Ogre::DisplayString>(output));
506            }
507        }
508    }
509
510    /**
511        @brief Shows the InGameConsole.
512    */
513    void InGameConsole::activate()
514    {
515        if (!this->bActive_)
516        {
517            this->bActive_ = true;
518            InputManager::getInstance().enterState("console");
519            this->shell_->registerListener(this);
520
521            this->windowResized(this->windowW_, this->windowH_);
522            this->linesChanged();
523            this->cursorChanged();
524            this->consoleOverlay_->show();
525
526            // scroll down
527            this->scroll_ = 1;
528            // the rest is done by tick
529        }
530    }
531
532    /**
533    @brief Hides the InGameConsole.
534    */
535    void InGameConsole::deactivate()
536    {
537        if (this->bActive_)
538        {
539            this->bActive_ = false;
540            GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()"); // Notify the SheetManager in lua, that the console has been closed.
541            InputManager::getInstance().leaveState("console");
542            this->shell_->unregisterListener(this);
543
544            // scroll up
545            this->scroll_ = -1;
546            // the rest is done by tick
547        }
548    }
549
550    /**
551        @brief Shifts all output lines one line up
552    */
553    void InGameConsole::shiftLines()
554    {
555        for (unsigned int i = LINES - 1; i > 1; --i)
556        {
557            this->consoleOverlayTextAreas_[i]->setCaption(this->consoleOverlayTextAreas_[i - 1]->getCaption());
558            this->consoleOverlayTextAreas_[i]->setColourTop(this->consoleOverlayTextAreas_[i - 1]->getColourTop());
559            this->consoleOverlayTextAreas_[i]->setColourBottom(this->consoleOverlayTextAreas_[i - 1]->getColourBottom());
560        }
561    }
562
563    void InGameConsole::colourLine(Shell::LineType type, int index)
564    {
565        ColourValue colourTop, colourBottom;
566        switch (type)
567        {
568        case Shell::Error:   colourTop = ColourValue(0.95f, 0.25f, 0.25f, 1.00f);
569                          colourBottom = ColourValue(1.00f, 0.50f, 0.50f, 1.00f); break;
570
571        case Shell::Warning: colourTop = ColourValue(0.95f, 0.50f, 0.20f, 1.00f);
572                          colourBottom = ColourValue(1.00f, 0.70f, 0.50f, 1.00f); break;
573
574        case Shell::Info:    colourTop = ColourValue(0.50f, 0.50f, 0.95f, 1.00f);
575                          colourBottom = ColourValue(0.80f, 0.80f, 1.00f, 1.00f); break;
576
577        case Shell::Debug:   colourTop = ColourValue(0.65f, 0.48f, 0.44f, 1.00f);
578                          colourBottom = ColourValue(1.00f, 0.90f, 0.90f, 1.00f); break;
579
580        case Shell::Verbose: colourTop = ColourValue(0.40f, 0.20f, 0.40f, 1.00f);
581                          colourBottom = ColourValue(0.80f, 0.60f, 0.80f, 1.00f); break;
582
583        case Shell::Ultra:   colourTop = ColourValue(0.21f, 0.69f, 0.21f, 1.00f);
584                          colourBottom = ColourValue(0.80f, 1.00f, 0.80f, 1.00f); break;
585
586        case Shell::Command: colourTop = ColourValue(0.80f, 0.80f, 0.80f, 1.00f);
587                          colourBottom = ColourValue(0.90f, 0.90f, 0.90f, 0.90f); break;
588
589        case Shell::Hint:    colourTop = ColourValue(0.80f, 0.80f, 0.80f, 1.00f);
590                          colourBottom = ColourValue(0.90f, 0.90f, 0.90f, 1.00f); break;
591
592        case Shell::TDebug:  colourTop = ColourValue(0.90f, 0.00f, 0.90f, 1.00f);
593                          colourBottom = ColourValue(1.00f, 0.00f, 1.00f, 1.00f); break;
594
595        default:             colourTop = ColourValue(0.90f, 0.90f, 0.90f, 1.00f);
596                          colourBottom = ColourValue(1.00f, 1.00f, 1.00f, 1.00f); break;
597        }
598
599        this->consoleOverlayTextAreas_[index]->setColourTop   (colourTop);
600        this->consoleOverlayTextAreas_[index]->setColourBottom(colourBottom);
601    }
602
603    // ################################
604    // ###      static methods      ###
605    // ################################
606
607    /**
608        @brief Activates the console.
609    */
610    /*static*/ void InGameConsole::openConsole()
611    {
612        InGameConsole::getInstance().activate();
613    }
614
615    /**
616        @brief Deactivates the console.
617    */
618    /*static*/ void InGameConsole::closeConsole()
619    {
620        GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()");  // Notify the SheetManager in lua, that the console has been closed, but not by ESC.
621        InGameConsole::getInstance().deactivate();
622    }
623
624}
Note: See TracBrowser for help on using the repository browser.