Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7450 in orxonox.OLD for trunk/src/lib/graphics/text_engine/text.h


Ignore:
Timestamp:
Apr 29, 2006, 9:38:44 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: added MultiLineText a Text for multiple line-input, that should automatically shilft position

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine/text.h

    r7355 r7450  
    88
    99#include "element_2d.h"
    10 
    11 #include "glincl.h"
    1210
    1311#define  TEXT_ALIGN_LEFT             E2D_ALIGN_LEFT
     
    2119#define  TEXT_DEFAULT_SIZE           20                         //!< default size of the Text
    2220
    23 
    2421// FORWARD DECLARATION
    2522class Font;
    2623struct SDL_Surface;
    27 
    28 //! A Struct to handel Texture Coordinates for quads
    29 struct TexCoord
    30 {
    31   float    minU;              //!< The minimum U-Coordinate
    32   float    maxU;              //!< The maximum U-Coordinate
    33   float    minV;              //!< The minimum V-Coordinate
    34   float    maxV;              //!< The maximum V-Coordinate
    35 };
    3624
    3725//! Represents one textElement.
     
    4230    virtual ~Text();
    4331
     32    // SETUP
    4433    void setFont(const std::string& fontFile, unsigned int renderSize);
     34    void setText(const std::string& text);
     35    /** @param blending the blending intensity to set (between 0.0 and 1.0) */
     36    inline void setBlending(float blending) { this->blending = blending; };
     37    /** @param r red @param g green @param b blue @brief sets the Color of the Text to render (values in [0-1]) */
     38    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); };
    4541
    46     void setText(const std::string& text);
    47 
     42    /// RETRIEVE
     43    /** @returns the pointer to the stored Font (not changeable) */
     44    inline const Font* const getFont() const { return this->font; };
    4845    /** @returns the String this Text displays */
    4946    inline const std::string& getText() const { return this->text; };
    50     /** @param blending the blending intensity to set (between 0.0 and 1.0) */
    51     inline void setBlending(float blending) { this->blending = blending; };
    52     /** sets the Color of the Text to render (values in [0-1]) @param r red @param g green @param b blue */
    53     void setColor(float r, float g, float b) { this->color = Vector(r, g, b); };
    54     /** sets the Size of the Font */
    55     void setSize(float size) { this->setSizeY2D(size); };
     47    /** @returns the Blending Value [0 invisible 1.0 full visible */
     48    inline float getBlending() const { return this->blending; };
     49    /** @returns: a Vector(r,g,b) @brief: retrieve a Vector holding the Color of the Text */
     50    inline const Vector& getColor() const { return this->color; };
    5651    /** @returns the Size of the Text */
    57 //    void getSize(float &x, float& y) const { return this->size; };
     52    inline float getSize() const { return this->getSizeY2D(); };
    5853
    5954    virtual void draw() const;
     
    6156    void debug() const;
    6257
    63   // helpers.
    64     static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
    65     static int powerOfTwo(int input);
    66 
     58  protected:
     59    virtual void setupTextWidth();
    6760  private:
    6861    Font*             font;           //!< Font of this text
Note: See TracChangeset for help on using the changeset viewer.