Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7453 in orxonox.OLD for trunk/src/lib/graphics/text_engine


Ignore:
Timestamp:
Apr 29, 2006, 10:08:38 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Size is local to text now

Location:
trunk/src/lib/graphics/text_engine
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine/multi_line_text.cc

    r7451 r7453  
    117117{
    118118  this->lineEnds.clear();
    119   this->lineEnds.push_back(0);
    120119  float width = 0.0f;
    121   // TODO make size local to this (not using the one from Element2D.
    122120  float maxWidth = this->lineWidth / this->getSize();
    123121
     
    133131      width += this->getFont()->getGlyphArray()[this->getText()[i]]->advance;
    134132  }
     133  this->setSizeY2D(this->lineEnds.size() * (this->lineSpacing+this->getFont()->getMaxHeight()));
    135134}
  • trunk/src/lib/graphics/text_engine/text.cc

    r7450 r7453  
    3939  this->blending = TEXT_DEFAULT_BLENDING;
    4040  this->color = TEXT_DEFAULT_COLOR;
    41   this->setSize(TEXT_DEFAULT_SIZE);
    42   this->setText("");
    43 
    4441
    4542  if (!fontFile.empty())
    4643    this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
    47   this->setSizeY2D(textSize);
     44
     45  this->setSize(TEXT_DEFAULT_SIZE);
    4846}
    4947
     
    9997  this->setupTextWidth();
    10098}
     99
     100
     101/**
     102 * @brief sets the Size of the Font
     103 * @param size :the size of the Text
     104 */
     105void Text::setSize(float size)
     106{
     107  this->size = size;
     108  this->setSizeY2D(size);
     109  this->setupTextWidth();
     110}
     111
    101112
    102113/**
  • trunk/src/lib/graphics/text_engine/text.h

    r7450 r7453  
    3737    /** @param r red @param g green @param b blue @brief sets the Color of the Text to render (values in [0-1]) */
    3838    void setColor(float r, float g, float b) { this->color = Vector(r, g, b); };
    39     /** @param size the Size of the Text @brief sets the Size of the Font */
    40     inline void setSize(float size) { this->setSizeY2D(size); };
     39    void setSize(float size);
    4140
    4241    /// RETRIEVE
     
    5049    inline const Vector& getColor() const { return this->color; };
    5150    /** @returns the Size of the Text */
    52     inline float getSize() const { return this->getSizeY2D(); };
     51    inline float getSize() const { return this->size; };
    5352
    5453    virtual void draw() const;
     
    5857  protected:
    5958    virtual void setupTextWidth();
     59
    6060  private:
    6161    Font*             font;           //!< Font of this text
     
    6464    Vector            color;          //!< The color of the font.
    6565    float             blending;       //!< The blending intensity.
     66    float             size;           //!< The size of the Text.
    6667};
    6768
Note: See TracChangeset for help on using the changeset viewer.