00001 
#ifndef DEF_FONT_H
00002 
#define DEF_FONT_H 1
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00025 typedef struct {
00026         SDL_Surface *surface;   
00027         
int charPos[512];
00028         
int maxPos;
00029 } 
SFont_Font;
00030 
00035 class Font {
00036     
public:
00037         
Font(SDL_Surface* surface);
00038         ~
Font();
00039         
int getHeight() 
const;
00040         
int getTextWidth(std::string text) 
const;
00041         
void write(SDL_Surface* surface, std::string text, 
int x, 
int y) 
const;
00042         
void writeCenter(SDL_Surface* surface, std::string text, 
int y) 
const;
00043         
void writeCenter(SDL_Surface* surface, std::string text, 
int x, 
int y) 
const;
00044     
private:
00045         
SFont_Font* initFont(SDL_Surface* 
Font);
00046         
static Uint32 getPixel(SDL_Surface* surface, Sint32 X, Sint32 Y);
00047         
SFont_Font* font;
00048 };
00049 
00050 
#endif