Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/console/src/orxonox/overlays/InGameConsole.cc @ 6004

Last change on this file since 6004 was 6004, checked in by rgrieder, 16 years ago

De-singletonised Shell so that both consoles have their own Shell instance. However they share the history.
Also modified IOConsole to hopefully work with status lines.

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