22 #ifndef BAGEL_BOFLIB_GFX_SPRITE_H 23 #define BAGEL_BOFLIB_GFX_SPRITE_H 25 #include "bagel/boflib/gfx/bitmap.h" 26 #include "bagel/boflib/object.h" 27 #include "bagel/boflib/gfx/palette.h" 28 #include "bagel/boflib/gui/window.h" 32 #define SPRITE_TOPMOST 0 33 #define SPRITE_FOREGROUND 64 34 #define SPRITE_MIDDLE 128 35 #define SPRITE_BACKGROUND 192 36 #define SPRITE_HINDMOST 255 40 static void initialize();
41 static void shutdown();
55 bool loadSprite(
const char *pszPathName,
int nCels = 1);
56 bool loadSprite(
CBofBitmap *pBitmap,
int nCels = 1);
58 bool paintSprite(
CBofBitmap *pBmp,
int x,
int y);
60 return paintSprite(pBmp, point.x, point.y);
63 bool paintSprite(
CBofWindow *pWnd,
int x,
int y);
65 return paintSprite(pWnd, point.x, point.y);
68 bool paintCel(
CBofWindow *pWnd,
int nCelId,
int x,
int y);
69 bool paintCel(
CBofBitmap *pBmp,
int nCelId,
int x,
int y);
71 void batchPaint(
int,
int y);
74 bool setupCels(
int nCels);
75 void setCel(
int nCelID);
81 return paintSprite(pBmp, _cPosition.x, _cPosition.y);
85 return paintSprite(pWnd, _cPosition.x, _cPosition.y);
98 return interception(_pSpriteChain);
102 return interception(newRect, _pSpriteChain);
107 void setPosition(
int x,
int y);
122 return _cRect.height();
126 return _cRect.width();
129 void setMaskColor(
int nColor) {
130 _nMaskColor = nColor;
133 int getMaskColor()
const {
137 byte readPixel(
int x,
int y)
const {
141 void setZOrder(
int nValue);
143 int getCelCount()
const {
146 int getCelIndex()
const {
150 void setAnimated(
bool bAnimated) {
151 _bAnimated = bAnimated;
153 bool getAnimated()
const {
160 const char *getFileName()
const {
165 static void closeLibrary();
167 static void setSharedPalette(
CBofPalette *pPalette);
170 return _pSpriteChain;
175 static void addToDirtyRect(
CBofRect *pRect);
176 static void clearDirtyRect() {
177 _cDirtyRect->setRectEmpty();
184 static void flushSpriteChain();
186 static void setupWorkArea(
int dx,
int dy);
187 static void tearDownWorkArea();
192 void setBlockAdvance(
bool b =
true) {
195 bool getBlockAdvance()
const {
196 return _bBlockAdvance;
218 bool _bDuplicated : 1;
219 bool _bPositioned : 1;
byte readPixel(int x, int y)
const char * getFileName()