Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1633 for code/trunk


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
Location:
code/trunk/src/orxonox/overlays
Files:
5 edited

Legend:

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

    r1632 r1633  
    122122
    123123        XMLPortParam(OrxonoxOverlay, "size",      setSize,      getSize,      xmlElement, mode)
    124             .defaultValues(Vector2(0.5f, 0.5f));
     124            .defaultValues(Vector2(1.0f, 1.0f));
    125125        XMLPortParam(OrxonoxOverlay, "pickPoint", setPickPoint, getPickPoint, xmlElement, mode)
    126126            .defaultValues(Vector2(0.0f, 0.0f));
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.h

    r1632 r1633  
    132132
    133133        //! Gets the current size that was set (uncorrected)
    134         Vector2 getSize() const                   { return this->size_ * this->sizeCorrection_; }
     134        const Vector2& getSize() const                   { return this->size_; }
    135135
    136136        //! Gets the actual size of the overlay on the screen (corrected)
    137         const Vector2& getActualSize() const      { return this->size_; }
     137        Vector2 getActualSize() const      { return this->size_ * this->sizeCorrection_; }
    138138
    139139        //! Gets the current size correction (default: 1.0, 1.0)
  • code/trunk/src/orxonox/overlays/OverlayGroup.cc

    r1628 r1633  
    116116    }
    117117
     118    //! Changes the visibility of all elements
     119    void OverlayGroup::changedVisibility()
     120    {
     121        for (std::map<std::string, OrxonoxOverlay*>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     122            (*it).second->setVisible(this->isVisible());
     123    }
     124
    118125
    119126    //########### Console commands ############
  • code/trunk/src/orxonox/overlays/OverlayGroup.h

    r1625 r1633  
    8080        OrxonoxOverlay* getElement(unsigned int index);
    8181
     82        void changedVisibility();
     83
    8284        std::map<std::string, OrxonoxOverlay*> hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
    8385        Vector2 scale_;                                         //!< Current scale (independant of the elements).
  • 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.