Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
|
00001 #ifndef _FRAME_BUFFER_H_ 00002 #define _FRAME_BUFFER_H_ 00003 00004 #include <nds.h> 00005 #include "mutablebitmapbase.h" 00006 00007 namespace WoopsiUI { 00008 00009 class Graphics; 00010 00021 class FrameBuffer : public MutableBitmapBase { 00022 public: 00023 00036 void copy(s16 x, s16 y, u32 size, u16* dest) const; 00037 00038 #ifdef USING_SDL 00039 // SDL version 00040 00047 FrameBuffer(SDL_Surface* surface, u16 width, u16 height, u16 yOffset); 00048 00053 const u16* getData() const; 00054 #else 00055 // DS version 00056 00063 FrameBuffer(u16* data, u16 width, u16 height); 00064 00069 inline const u16* getData() const { return _bitmap; }; 00070 #endif 00071 00075 virtual inline ~FrameBuffer() { }; 00076 00083 const u16 getPixel(s16 x, s16 y) const; 00084 00091 virtual void setPixel(const s16 x, const s16 y, const u16 colour); 00092 00100 inline const u16* getData(s16 x, s16 y) const; 00101 00107 Graphics* newGraphics(); 00108 00116 void blit(const s16 x, const s16 y, const u16* data, const u32 size); 00117 00125 void blitFill(const s16 x, const s16 y, const u16 colour, const u32 size); 00126 00127 protected: 00128 00129 #ifdef USING_SDL 00130 // SDL version 00131 SDL_Surface* _surface; 00132 u16 _yOffset; 00133 u16* _dataBuffer; 00141 void putSDLPixel(int x, int y, Uint32 pixel); 00142 00149 Uint32 getSDLPixel(int x, int y); 00150 #else 00151 // DS version 00152 u16* _bitmap __attribute__ ((aligned (4))); 00153 #endif 00154 00158 inline FrameBuffer(const FrameBuffer& bitmap) { }; 00159 }; 00160 } 00161 00162 #endif