22 #ifndef BAGEL_BOFLIB_GFX_SPRITE_H 23 #define BAGEL_BOFLIB_GFX_SPRITE_H 25 #include "bagel/spacebar/boflib/gfx/bitmap.h" 26 #include "bagel/boflib/object.h" 27 #include "bagel/boflib/palette.h" 28 #include "bagel/spacebar/boflib/gui/window.h" 33 #define SPRITE_TOPMOST 0 34 #define SPRITE_FOREGROUND 64 35 #define SPRITE_MIDDLE 128 36 #define SPRITE_BACKGROUND 192 37 #define SPRITE_HINDMOST 255 41 static void initialize();
42 static void shutdown();
56 bool loadSprite(
const char *pszPathName,
int nCels = 1);
57 bool loadSprite(
CBofBitmap *pBitmap,
int nCels = 1);
59 bool paintSprite(
CBofBitmap *pBmp,
int x,
int y);
61 return paintSprite(pBmp, point.x, point.y);
64 bool paintSprite(
CBofWindow *pWnd,
int x,
int y);
66 return paintSprite(pWnd, point.x, point.y);
69 bool paintCel(
CBofWindow *pWnd,
int nCelId,
int x,
int y);
70 bool paintCel(
CBofBitmap *pBmp,
int nCelId,
int x,
int y);
72 void batchPaint(
int,
int y);
75 bool setupCels(
int nCels);
76 void setCel(
int nCelID);
82 return paintSprite(pBmp, _cPosition.x, _cPosition.y);
86 return paintSprite(pWnd, _cPosition.x, _cPosition.y);
99 return interception(_pSpriteChain);
103 return interception(newRect, _pSpriteChain);
108 void setPosition(
int x,
int y);
123 return _cRect.height();
127 return _cRect.width();
130 void setMaskColor(
int nColor) {
131 _nMaskColor = nColor;
134 int getMaskColor()
const {
138 byte readPixel(
int x,
int y)
const {
142 void setZOrder(
int nValue);
144 int getCelCount()
const {
147 int getCelIndex()
const {
151 void setAnimated(
bool bAnimated) {
152 _bAnimated = bAnimated;
154 bool getAnimated()
const {
161 const char *getFileName()
const {
166 static void closeLibrary();
168 static void setSharedPalette(
CBofPalette *pPalette);
171 return _pSpriteChain;
176 static void addToDirtyRect(
CBofRect *pRect);
177 static void clearDirtyRect() {
178 _cDirtyRect->setRectEmpty();
185 static void flushSpriteChain();
187 static void setupWorkArea(
int dx,
int dy);
188 static void tearDownWorkArea();
193 void setBlockAdvance(
bool b =
true) {
196 bool getBlockAdvance()
const {
197 return _bBlockAdvance;
219 bool _bDuplicated : 1;
220 bool _bPositioned : 1;
byte readPixel(int x, int y)
const char * getFileName()