Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

cfont.h

Go to the documentation of this file.
00001 #ifndef CFONT_H
00002 #define CFONT_H
00003 
00013 #include "cvideo.h"
00014 
00015 #include <stdlib.h>
00016 
00021 class CFont {
00022 private:
00023   /* ASCII value to subtract from every ASCII character we're asked to print. */
00024   static const int CHAR_CODE_OFFSET = 32;
00025 
00026   /* Tiled bitmap used to get the character bitmap data from. */
00027   CSurface bitmap;
00028 
00029   /* Width of each character on the tiled bitmap. */
00030   int char_width;
00031 
00032   /* Height of each character on the tiled bitmap. */
00033   int char_height;
00034 
00035   /* Characters per line on the tiled bitmap. */
00036   int bitmap_chars_per_line;
00037 
00038 public:
00040   CFont(const char *bmp_filename, int char_width, int char_height, int bitmap_chars_per_line);
00041 
00043   void draw_string(CSurface *surface, CPoint point, const char *string);
00044 
00046   void draw_string_opaque(CSurface *surface, CPoint point, const char *string);
00047 
00049   void draw_string_centered(CSurface *surface, CPoint point, const char *string);
00050 
00052   int get_char_width() { return char_width; }
00053 
00055   int get_char_height() { return char_height; }
00056 
00058   CPoint get_string_size(const char *str) {
00059     return CPoint((int)strlen(str) * char_width, char_height);
00060   }
00061 };
00062 
00063 #endif

Generated on Wed Aug 27 11:58:41 2003 for GFW by doxygen 1.3.3