Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- File List

# graphicsport.h

    00001 #ifndef _GRAPHICS_PORT_H_
    00002 #define _GRAPHICS_PORT_H_
    00003
    00004 #include <nds.h>
    00005 #include "gadget.h"
    00006 #include "woopsiarray.h"
    00007 #include "graphics.h"
    00008
    00009 namespace WoopsiUI {
    00010
    00011         class FontBase;
    00012         class FrameBuffer;
    00013         class BitmapBase;
    00014
    00044         class GraphicsPort {
    00045         public:
    00046
    00089                 GraphicsPort(const s16 x, const s16 y, const u16 width, const u16 height, const bool isEnabled, FrameBuffer* bitmap, const WoopsiArray<Rect>* clipRectList, const Rect* clipRect);
    00090
    00094                 virtual inline ~GraphicsPort() {
    00095                         delete _graphics;
    00096                 };
    00097
    00107                 void setClipRect(const Rect& clipRect);
    00108
    00116                 void getClipRect(Rect& rect) const;
    00117
    00122                 inline const s16 getX() const { return _rect.x; };
    00123
    00128                 const s16 getY() const { return _rect.y; };
    00129
    00136                 void drawPixel(s16 x, s16 y, u16 colour);
    00137
    00146                 void drawFilledRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00147
    00156                 void drawRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00157
    00167                 void drawBevelledRect(s16 x, s16 y, u16 width, u16 height, u16 shineColour, u16 shadowColour);
    00168
    00176                 virtual void drawXORPixel(s16 x, s16 y, u16 colour);
    00177
    00186                 virtual void drawXORHorizLine(s16 x, s16 y, u16 width, u16 colour);
    00187
    00196                 virtual void drawXORVertLine(s16 x, s16 y, u16 height, u16 colour);
    00197
    00207                 virtual void drawXORRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00208
    00218                 virtual void drawFilledXORRect(s16 x, s16 y, u16 width, u16 height, u16 colour);
    00219
    00225                 virtual void drawXORPixel(s16 x, s16 y);
    00226
    00233                 void drawXORHorizLine(s16 x, s16 y, u16 width);
    00234
    00241                 void drawXORVertLine(s16 x, s16 y, u16 height);
    00242
    00250                 void drawXORRect(s16 x, s16 y, u16 width, u16 height);
    00251
    00259                 void drawFilledXORRect(s16 x, s16 y, u16 width, u16 height);
    00260
    00268                 void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string);
    00269
    00281                 void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string, s32 startIndex, s32 length, u16 colour);
    00282
    00293                 void drawText(s16 x, s16 y, FontBase* font, const WoopsiString& string, s32 startIndex, s32 length);
    00294
    00306         void drawBaselineText(s16 x, s16 y, FontBase* font, const WoopsiString& string, s32 startIndex, s32 length);
    00307
    00320                 void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY);
    00321
    00338                 void drawBitmap(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY, u16 transparentColour);
    00339
    00354                 virtual void drawBitmapGreyScale(s16 x, s16 y, u16 width, u16 height, const BitmapBase* bitmap, s16 bitmapX, s16  bitmapY);
    00355
    00364                 void drawLine(s16 x1, s16 y1, s16 x2, s16 y2, u16 colour);
    00365
    00380                 void copy(s16 sourceX, s16 sourceY, s16 destX, s16 destY, u16 width, u16 height);
    00381
    00398                 void scroll(s16 x, s16 y, s16 xDistance, s16 yDistance, u16 width, u16 height, WoopsiArray<Rect>* revealedRects);
    00399
    00407                 void dim(s16 x, s16 y, u16 width, u16 height);
    00408
    00416                 void greyScale(s16 x, s16 y, u16 width, u16 height);
    00417
    00426                 virtual void drawEllipse(s16 xCentre, s16 yCentre, s16 horizRadius, s16 vertRadius, u16 colour);
    00427
    00436                 virtual void drawFilledEllipse(s16 xCentre, s16 yCentre, s16 horizRadius, s16 vertRadius, u16 colour);
    00437
    00438         private:
    00439                 WoopsiArray<Rect> _clipRectList;
    00440                 Rect _rect;
    00441                 bool _isEnabled;
    00442                 Graphics* _graphics;
    00443                 bool _isTopScreen;
    00445                 void convertPortToScreenSpace(s16* x, s16* y);
    00446                 void addClipRect(const Rect& clipRect);
    00447         };
    00448 }
    00449
    00450 #endif