- Main Page
- Classes
- Files

- File List

# fontbase.h

    00001 #ifndef _FONT_BASE_H_
    00002 #define _FONT_BASE_H_
    00003
    00004 #include <nds.h>
    00005
    00006 #define GLYPH_MAP_SIZE 32
    00007
    00008 namespace WoopsiUI {
    00009
    00010         class MutableBitmapBase;
    00011         class WoopsiString;
    00012
    00018         class FontBase {
    00019
    00020         public:
    00021
    00028                 FontBase(const u8 height, const u16 transparentColour = 0) {
    00029                         _height = height;
    00030                         _drawColour = 0;
    00031                         _isMonochrome = false;
    00032                 }
    00033
    00037                 virtual inline ~FontBase() { };
    00038
    00045                 virtual const bool isCharBlank(const u32 letter) const = 0;
    00046
    00052                 void setColour(const u16 colour) {
    00053                         _drawColour = colour;
    00054                         _isMonochrome = true;
    00055                 }
    00056
    00064                 inline const u16 getColour() const { return _drawColour; };
    00065
    00071                 inline const bool isMonochrome() const { return _isMonochrome; };
    00072
    00078                 inline const u16 getTransparentColour() const { return _transparentColour; };
    00079
    00084                 inline void setTransparentColour(const u16 colour) { _transparentColour = colour; };
    00085
    00090                 inline void clearColour() {
    00091                         _isMonochrome = false;
    00092                         _drawColour = 0;
    00093                 };
    00094
    00107                 virtual s16 drawChar(MutableBitmapBase* bitmap, u32 letter, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2) = 0;
    00108
    00114                 virtual u16 getStringWidth(const WoopsiString& text) const = 0;
    00115
    00124                 virtual u16 getStringWidth(const WoopsiString& text, s32 startIndex, s32 length) const = 0;
    00125
    00131                 virtual u16 getCharWidth(u32 letter) const = 0;
    00132
    00138                 virtual u16 getCharHeight(u32 letter) const { return _height; };
    00139
    00144                 inline const u8 getHeight() const { return _height; };
    00145
    00146         private:
    00147                 u8 _height;
    00148                 u16 _drawColour;
    00149                 bool _isMonochrome;
    00150                 u16 _transparentColour;
    00151         };
    00152 }
    00153
    00154 #endif