Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 9, 2005, 10:32:18 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: compiling again, many movements… still working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/lib/graphics/font/text_engine.h

    r3768 r3769  
    9393{
    9494 public:
    95   Text(void);
     95  Text(Font* font, int type = TEXT_DYNAMIC);
    9696  ~Text(void);
    9797
     
    101101  void setText(const char* text);
    102102  void setPosition(int x, int y);
     103
     104  // Static Text
     105  void setColor(Uint8 r, Uint8 g, Uint8 b);
     106  void setStyle(char* renderStyle);
     107  void createTexture();
     108
     109  // Dynamic Text
     110 
     111
    103112
    104113  virtual void draw(void);
     
    113122  GLuint texture;                //!< A GL-texture to hold the text
    114123  TexCoord texCoord;             //!< Texture-coordinates \todo fix this to have a struct
    115   SDL_Rect posSize;          //!< An SDL-Rectangle representing the position and size of the Text on the screen.
     124  SDL_Rect posSize;              //!< An SDL-Rectangle representing the position and size of the Text on the screen.
    116125 
    117126  PNode* bindNode;               //!< A node the Text is bind to. (if NULL thr node will not be bound to anything.)
     
    124133class Font
    125134{
     135  friend class Text;
    126136 public:
    127137  Font(const char* fontFile, unsigned int fontSize = FONT_DEFAULT_SIZE,
     
    132142  bool setFont(const char* fontFile);
    133143  void setSize(unsigned int fontSize);
    134   void setColor(Uint8 r, Uint8 g, Uint8 b);
     144  void setFastColor(Uint8 r, Uint8 g, Uint8 b);
    135145  void setStyle(char* renderStyle);
    136146
    137147  inline Glyph** getGlyphArray(void) {return glyphArray;}
    138148  inline GLuint getFastTextureID(void) {return fastTextureID;}
    139   void createTexture(void);
    140149 
    141150 
     
    148157  char* fontFile;                   //!< The fontfile from whitch the font was loaded.
    149158  unsigned int fontSize;            //!< The size of the font in pixels. each Font has one size.
    150   int renderStyle;               //!< The Renderstyle
     159  int renderStyle;                  //!< The Renderstyle
    151160 
    152161  Glyph** glyphArray;               //!< An Array of all the Glyphs stored in the Array of Glyphs.
    153162  GLuint fastTextureID;             //!< The fast textureID.
     163  SDL_Color fastColor;              //!< A Color for the fast Texture.
    154164
    155165  tList<Text>* textList;
    156   Text* currentText;
    157166
    158167  int getMaxHeight(void);
     
    166175
    167176  GLuint createFastTexture();
    168   GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
    169177
    170178  void initGlyphs(Uint16 from, Uint16 count);
    171179  int findOptimalFastTextureSize(void);
    172   static int powerOfTwo(int input);
    173180
    174181  void debug(void);
    175182
    176183};
     184GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
     185int powerOfTwo(int input);
    177186
    178187
     
    187196  virtual ~TextEngine(void);
    188197
     198  Text* createText(const char* fontFile,
     199                   unsigned int fontSize = FONT_DEFAULT_SIZE,
     200                   Uint8 r = FONT_DEFAULT_COLOR_R,
     201                   Uint8 g = FONT_DEFAULT_COLOR_G,
     202                   Uint8 b = FONT_DEFAULT_COLOR_B);
     203
     204  void draw(void);
     205
     206 private:
     207  TextEngine(void);
     208  static TextEngine* singletonRef;
     209
    189210  // general
    190211  static void enableFonts(void);
     
    192213  static bool checkVersion(void);
    193214
    194  private:
    195   TextEngine(void);
    196   static TextEngine* singletonRef;
    197 
    198   tList<Font>* fontList;
     215
     216  //  tList<Font>* fontList;
     217  tList<Text>* textList;
    199218
    200219};
Note: See TracChangeset for help on using the changeset viewer.