Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 11, 2005, 12:55:48 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: setClassID implemented in all files

File:
1 edited

Legend:

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

    r4536 r4597  
    1 /*! 
     1/*!
    22    \file text_engine.h
    33    \brief Definition of textEngine, the Font and the Text
     
    3030
    3131//! An enumerator for the text alignment.
    32 enum TEXT_ALIGNMENT { TEXT_ALIGN_LEFT,
    33                       TEXT_ALIGN_RIGHT,
    34                       TEXT_ALIGN_CENTER,
    35                       TEXT_ALIGN_SCREEN_CENTER };
     32 enum TEXT_ALIGNMENT
     33{
     34  TEXT_ALIGN_LEFT,
     35  TEXT_ALIGN_RIGHT,
     36  TEXT_ALIGN_CENTER,
     37  TEXT_ALIGN_SCREEN_CENTER
     38};
    3639
    3740/* some default values */
    3841#define FONT_DEFAULT_SIZE       50                   //!< default size of the Text
    39 #define FONT_DEFAULT_TEXT       "orxonox 1234567890" //!< default text to display
     42#define FONT_DEFAULT_TEXT       "orxonox 1234567890" //!< default text to display
    4043#define FONT_DEFAULT_COLOR_R    255                  //!< default red part (color) of the text
    4144#define FONT_DEFAULT_COLOR_G    255                  //!< default red green (color) of the text
     
    8689  int      bearingY;          //!< How much is above the Origin
    8790  int      advance;           //!< How big a Glyph would be in monospace-mode
    88  
     91
    8992  // OpenGL-specific
    9093  //  TexCoord texCoord;      //!< A Texture Coordinate for this glyph.
     
    117120
    118121  void draw(void) const;
    119  
     122
    120123  void debug(void) const;
    121124
    122125 private:
    123126  Text(Font* font, int type = TEXT_DYNAMIC);
    124  
     127
    125128  static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
    126129  static int powerOfTwo(int input);
     
    139142  TexCoord          texCoord;       //!< Texture-coordinates \todo fix this to have a struct
    140143  SDL_Rect          posSize;        //!< An SDL-Rectangle representing the position and size of the Text on the screen.
    141  
     144
    142145  PNode*            bindNode;       //!< A node the Text is bind to. (if NULL thr node will not be bound to anything.)
    143146};
     
    147150////////////
    148151//! A class to handle a Font of a certain ttf-File, Size and Color.
    149 class Font
     152class Font : public BaseObject
    150153{
    151154  friend class Text;
     
    170173  /** \returns the texture to the fast-texture */
    171174  inline GLuint getFastTextureID(void) const {return fastTextureID;}
    172  
     175
    173176 private:
    174177  int getMaxHeight(void);
     
    193196  unsigned int  fontSize;            //!< The size of the font in pixels. each Font has one size.
    194197  int           renderStyle;         //!< The Renderstyle
    195  
     198
    196199  Glyph**       glyphArray;          //!< An Array of all the Glyphs stored in the Array of Glyphs.
    197200  GLuint        fastTextureID;       //!< The fast textureID.
     
    205208///////////////////
    206209//! A singleton Class that operates as a Handler for generating and rendering Text in 2D
    207 class TextEngine : public BaseObject 
     210class TextEngine : public BaseObject
    208211{
    209212 public:
     
    213216
    214217  Text* createText(const char* fontFile,
    215                    unsigned int fontSize = FONT_DEFAULT_SIZE,
    216                    int textType = TEXT_DYNAMIC,
    217                    Uint8 r = FONT_DEFAULT_COLOR_R,
    218                    Uint8 g = FONT_DEFAULT_COLOR_G,
    219                    Uint8 b = FONT_DEFAULT_COLOR_B);
    220  
     218                   unsigned int fontSize = FONT_DEFAULT_SIZE,
     219                   int textType = TEXT_DYNAMIC,
     220                   Uint8 r = FONT_DEFAULT_COLOR_R,
     221                   Uint8 g = FONT_DEFAULT_COLOR_G,
     222                   Uint8 b = FONT_DEFAULT_COLOR_B);
     223
    221224  void deleteText(Text* text);
    222225  void flush(void);
    223226
    224227  void draw(void) const;
    225  
     228
    226229  void debug(void) const;
    227230
Note: See TracChangeset for help on using the changeset viewer.