Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/usability/src/orxonox/overlays/InGameConsole.cc @ 8035

Last change on this file since 8035 was 8035, checked in by dafrick, 13 years ago

Replacing hard coded keys for the menu navigation with keys specified in the keybindings.ini file (note: You have to delete your keybindings.ini file for it to be regenerated and work correctly).
The upside is, that now we need less hackish, stuff, it's better integrated, toggling of OrxonoxOverlays (e.g. QuestGUI and PickupInventory, among others) is working again. Closing the InGameConsole with ESC no longer requires a workaround to work.
The downside is, that now GUI sheets that require input, e.g. GraphicsMenu or MiscConfigMenu, no longer support menu navigation and ESC doesn't work there. However, I don't know how to work around that, yet. But since all that ESC business is a hack anyway, I'd rather have the hacks there…

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