- Main Page
- Classes
- Files

- File List

# C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/fixedwidthfontbase.h

    00001 #ifndef _FIXED_WIDTH_FONT_BASE_H_
    00002 #define _FIXED_WIDTH_FONT_BASE_H_
    00003
    00004 #include <nds.h>
    00005 #include <string.h>
    00006 #include "fontbase.h"
    00007
    00008 namespace WoopsiUI {
    00009
    00014         class FixedWidthFontBase : public FontBase {
    00015
    00016         public:
    00017
    00027                 FixedWidthFontBase(const u16 bitmapWidth, const u16 bitmapHeight, const u8 width, const u8 height, const u16 transparentColour = 0);
    00028
    00032                 virtual inline ~FixedWidthFontBase() { };
    00033
    00038                 inline const u16 getBitmapWidth() const { return _bitmapWidth; };
    00039
    00044                 inline const u16 getBitmapHeight() const { return _bitmapHeight; };
    00045
    00052                 virtual const u16 getPixel(const s16 x, const s16 y) const = 0;
    00053
    00058                 inline const u8 getWidth() const { return _width; };
    00059
    00065                 inline u16 getStringWidth(const char* text) const { return strlen(text) * getWidth(); };
    00066
    00075                 inline u16 getStringWidth(const char* text, u16 length) const { return length * getWidth(); };
    00076
    00082                 inline u16 getCharWidth(char letter) const { return getWidth(); };
    00083
    00090                 virtual inline const bool isCharBlank(const char letter) const { return !(_glyphMap[letter >> 3] & (1 << (letter % 8))); };
    00091
    00092         protected:
    00099                 virtual void createGlyphMap();
    00100
    00108                 virtual const bool scanGlyph(const u16 x, const u16 y) const = 0;
    00109
    00110         protected:
    00111
    00116                 void initGlyphMap();
    00117
    00118                 u8 _glyphMap[GLYPH_MAP_SIZE];
    00120         private:
    00121                 u8 _width;
    00122                 u16 _bitmapWidth;
    00123                 u16 _bitmapHeight;
    00124         };
    00125 }
    00126
    00127 #endif