Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- 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 const s32 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;  // This is flawed as it doesn't allow 2 different fonts on the same line
    00108
    00121                 virtual s16 drawBaselineChar(MutableBitmapBase* bitmap, u32 letter, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2) = 0;
    00122
    00128                 virtual u16 getStringWidth(const WoopsiString& text) const = 0;
    00129
    00138                 virtual u16 getStringWidth(const WoopsiString& text, s32 startIndex, s32 length) const = 0;
    00139
    00145                 virtual u8 getCharWidth(u32 letter) const = 0;
    00146
    00152                 virtual u8 getCharHeight(u32 letter) const { return _height; };
    00153
    00159                 virtual s8 getCharTop(u32 letter) const = 0;
    00160
    00165                 inline const u8 getHeight() const { return _height; };
    00166
    00167         private:
    00168                 u8 _height;
    00169                 u16 _drawColour;
    00170                 bool _isMonochrome;
    00171                 u16 _transparentColour;
    00172         };
    00173 }
    00174
    00175 #endif