Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 9, 2005, 12:54:09 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: implemented default font.

File:
1 edited

Legend:

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

    r5306 r5336  
    2121
    2222#ifdef HAVE_SDL_TTF_H
    23 #include "SDL_ttf.h"
     23#include <SDL_ttf.h>
    2424#else
    25 #include "SDL/SDL_ttf.h"
     25#include <SDL/SDL_ttf.h>
    2626#endif
    2727
     
    4646#define FONT_NUM_COLORS              256                        //!< number of colors.
    4747
    48 #define FONT_HIGHEST_KNOWN_CHAR      128                        //!< The highest character known to the textEngine.
     48#define FONT_HIGHEST_KNOWN_CHAR      256                        //!< The highest character known to the textEngine.
    4949
    5050#define TEXT_DEFAULT_ALIGNMENT       TEXT_ALIGN_CENTER          //!< default alignment
     
    129129  void debug() const;
    130130
     131  // helpers.
     132  static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
     133  static int powerOfTwo(int input);
     134
    131135 private:
    132136   Text(Font* font = NULL, TEXT_RENDER_TYPE type = TEXT_RENDER_DYNAMIC);
    133137   void setFont(Font* font);
    134138
    135    static GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord);
    136    static int powerOfTwo(int input);
    137139
    138140 private:
     
    163165  Font(const char* fontFile,
    164166       unsigned int fontSize = FONT_DEFAULT_SIZE);
     167  Font(char** xpmArray);
    165168
    166169  virtual ~Font();
     
    168171  // font
    169172  bool loadFont(const char* fontFile);
     173  bool loadFontFromXPMArray(char** xpmArray);
     174
    170175  void setSize(unsigned int fontSize);
    171176  void setStyle(const char* renderStyle);
     
    175180  /** @returns the texture to the fast-texture */
    176181  inline GLuint getFastTextureID() const { return fastTextureID; };
     182  /** @returns the default Font */
     183  inline static Font* getDefaultFont() { return Font::defaultFont; };
     184
     185  static void initDefaultFont();
     186  static void removeDefaultFont();
    177187
    178188 private:
     
    190200
    191201 private:
    192   // general purpose
    193   GLdouble      projMat[16];         //!< The Projection Matrix
    194 
     202  static Font*  defaultFont;         //!< a default font, that is used, if other fonts were unable to be loaded.
    195203  // information about the Font
    196204  TTF_Font*     font;                //!< The font we use for this.
Note: See TracChangeset for help on using the changeset viewer.