- Main Page
- Classes
- Files

- File List

# fixedwidthfontbase.h

    00001 #ifndef _FIXED_WIDTH_FONT_BASE_H_
    00002 #define _FIXED_WIDTH_FONT_BASE_H_
    00003
    00004 #include <nds.h>
    00005 #include "fontbase.h"
    00006
    00007 namespace WoopsiUI {
    00008
    00014         class FixedWidthFontBase : public FontBase {
    00015
    00016         public:
    00017
    00029                 FixedWidthFontBase(const u16 bitmapWidth, const u16 bitmapHeight, const u8 width, const u8 height, const u16 transparentColour = 0);
    00030
    00034                 virtual inline ~FixedWidthFontBase() { };
    00035
    00040                 inline const u16 getBitmapWidth() const { return _bitmapWidth; };
    00041
    00046                 inline const u16 getBitmapHeight() const { return _bitmapHeight; };
    00047
    00054                 virtual const u16 getPixel(const s16 x, const s16 y) const = 0;
    00055
    00060                 inline const u8 getWidth() const { return _width; };
    00061
    00067                 u16 getStringWidth(const WoopsiString& text) const;
    00068
    00080                 inline u16 getStringWidth(const WoopsiString& text, s32 startIndex, s32 length) const { return length * getWidth(); };
    00081
    00087                 inline u16 getCharWidth(u32 letter) const { return getWidth(); };
    00088
    00095                 virtual inline const bool isCharBlank(const u32 letter) const { return !(_glyphMap[letter >> 3] & (1 << (letter % 8))); };
    00096
    00097         protected:
    00105                 virtual void createGlyphMap();
    00106
    00114                 virtual const bool scanGlyph(const u16 x, const u16 y) const = 0;
    00115
    00116         protected:
    00117
    00122                 void initGlyphMap();
    00123
    00124                 u8 _glyphMap[GLYPH_MAP_SIZE];
    00126         private:
    00127                 u8 _width;
    00128                 u16 _bitmapWidth;
    00129                 u16 _bitmapHeight;
    00130         };
    00131 }
    00132
    00133 #endif