Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 29, 2008, 6:45:53 PM (16 years ago)
Author:
rgrieder
Message:
  • added font generation for the console (so that we can create the exact font size, looks sharper)
  • fixed 2 bugs with the size of an OrxonoxOverlay
  • fixed a bug with the visibility of entire OverlayGroups
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/overlays/console/InGameConsole.cc

    r1625 r1633  
    3636#include <OgreOverlayManager.h>
    3737#include <OgreOverlayContainer.h>
    38 #include <OgreStringConverter.h>
    39 
     38#include <OgreFontManager.h>
     39#include <OgreFont.h>
     40
     41#include "util/Math.h"
     42#include "util/Convert.h"
    4043#include "core/Debug.h"
    4144#include "core/CoreIncludes.h"
     
    4346#include "core/ConsoleCommand.h"
    4447#include "core/input/InputManager.h"
    45 #include "util/Math.h"
    4648#include "GraphicsEngine.h"
    4749
     
    136138        this->consoleOverlayContainer_->addChild(this->consoleOverlayBorder_);
    137139
     140        // create a new font to match the requested size exactly
     141        Ogre::FontPtr font = static_cast<Ogre::FontPtr>
     142            (Ogre::FontManager::getSingleton().create("MonofurConsole", "General"));
     143        font->setType(Ogre::FT_TRUETYPE);
     144        font->setSource("Monofur.ttf");
     145        font->setTrueTypeSize(18);
     146        // reto: I don't know why, but setting the resolution twice as high makes the font look a lot clearer
     147        font->setTrueTypeResolution(192);
     148        font->addCodePointRange(Ogre::Font::CodePointRange(33, 126));
     149        font->addCodePointRange(Ogre::Font::CodePointRange(161, 255));
     150
    138151        // create the text lines
    139152        this->consoleOverlayTextAreas_ = new Ogre::TextAreaOverlayElement*[LINES];
    140153        for (int i = 0; i < LINES; i++)
    141154        {
    142             this->consoleOverlayTextAreas_[i] = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "InGameConsoleTextArea" + Ogre::StringConverter::toString(i)));
     155            this->consoleOverlayTextAreas_[i] = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "InGameConsoleTextArea" + convertToString(i)));
    143156            this->consoleOverlayTextAreas_[i]->setMetricsMode(Ogre::GMM_PIXELS);
    144             this->consoleOverlayTextAreas_[i]->setFontName("Monofur");
     157            this->consoleOverlayTextAreas_[i]->setFontName("MonofurConsole");
    145158            this->consoleOverlayTextAreas_[i]->setCharHeight(18);
    146159            this->consoleOverlayTextAreas_[i]->setParameter("colour_top", "0.21 0.69 0.21");
     
    153166        this->consoleOverlayCursor_ = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "InGameConsoleCursor"));
    154167        this->consoleOverlayCursor_->setMetricsMode(Ogre::GMM_PIXELS);
    155         this->consoleOverlayCursor_->setFontName("Monofur");
     168        this->consoleOverlayCursor_->setFontName("MonofurConsole");
    156169        this->consoleOverlayCursor_->setCharHeight(18);
    157170        this->consoleOverlayCursor_->setParameter("colour_top", "0.21 0.69 0.21");
Note: See TracChangeset for help on using the changeset viewer.