@@ -11,11 +11,18 @@ class Sprite {
1111 bool _top;
1212 OamState *_oam;
1313 int _id = -1 ;
14- int _rotId = -1 ;
15- bool _visible = true ;
1614 SpriteSize _size;
1715 SpriteColorFormat _format;
1816
17+ u16 *_gfx = nullptr ;
18+ int _affineIndex = -1 ;
19+ int _paletteAlpha = 0 ;
20+ int _priority = 0 ;
21+ int _x = 0 , _y = 0 ;
22+ bool _hFlip = false , _vFlip = false ;
23+ bool _sizeDouble = false ;
24+ bool _visible = true ;
25+
1926public:
2027 Sprite (bool top, SpriteSize size, SpriteColorFormat format);
2128 Sprite (const Sprite &sprite);
@@ -27,18 +34,28 @@ class Sprite {
2734 Sprite &update (void ) { oamUpdate (_oam); return *this ; }
2835
2936 int id (void ) const { return _id; }
37+
38+ u16 *gfx (void ) const { return _gfx; }
39+ int affineIndex (void ) const { return _affineIndex; }
40+ int paletteAlpha (void ) const { return _paletteAlpha; }
41+ int priority (void ) const { return _priority; }
42+ int x (void ) const { return _x; }
43+ int y (void ) const { return _y; }
44+ bool hFlip (void ) const { return _hFlip; }
45+ bool vFlip (void ) const { return _vFlip; }
46+ bool sizeDouble (void ) const { return _sizeDouble; }
3047 bool visible (void ) const { return _visible; }
3148
32- Sprite &affineIndex (int affineIndex, bool sizeDouble) { _rotId = affineIndex; oamSetAffineIndex (_oam, _id, _rotId, sizeDouble); return *this ; }
33- Sprite &affineTransform (float hdx, float hdy, float vdx, float vdy) { if (_rotId >= 0 && _rotId <= 31 ) oamAffineTransformation (_oam, _rotId, FLOAT_TO_FIXED (hdx), FLOAT_TO_FIXED (hdy), FLOAT_TO_FIXED (vdx), FLOAT_TO_FIXED (vdy)); return *this ; }
34- Sprite &alpha (int alpha) { oamSetAlpha (_oam, _id, alpha); return *this ; }
35- Sprite &flip (bool hflip, bool vflip) { oamSetFlip (_oam, _id, hflip, vflip); return *this ; }
36- Sprite &gfx (u16 *gfx) { oamSetGfx (_oam, _id, _size, _format, gfx); return *this ; }
37- Sprite &palette (int palette) { oamSetPalette (_oam, _id, palette); return *this ; }
38- Sprite &priority (int priority) { oamSetPriority (_oam, _id, priority); return *this ; }
39- Sprite &rotateScale (int angle, float sx, float sy) { if (_rotId >= 0 && _rotId <= 31 ) oamRotateScale (_oam, _rotId, angle, FLOAT_TO_FIXED (sx), FLOAT_TO_FIXED (sy)); return *this ; }
49+ Sprite &affineIndex (int affineIndex, bool sizeDouble) { _affineIndex = affineIndex, _sizeDouble = sizeDouble; oamSetAffineIndex (_oam, _id, _affineIndex, _sizeDouble); return *this ; }
50+ Sprite &affineTransform (float hdx, float hdy, float vdx, float vdy) { if (_affineIndex >= 0 && _affineIndex <= 31 ) oamAffineTransformation (_oam, _affineIndex, FLOAT_TO_FIXED (hdx), FLOAT_TO_FIXED (hdy), FLOAT_TO_FIXED (vdx), FLOAT_TO_FIXED (vdy)); return *this ; }
51+ Sprite &alpha (int alpha) { _paletteAlpha = alpha; oamSetAlpha (_oam, _id, _paletteAlpha); return *this ; }
52+ Sprite &flip (bool hFlip, bool vFlip) { _hFlip = hFlip, _vFlip = vFlip; oamSetFlip (_oam, _id, _hFlip, _vFlip); return *this ; }
53+ Sprite &gfx (u16 *gfx) { _gfx = gfx; oamSetGfx (_oam, _id, _size, _format, _gfx); return *this ; }
54+ Sprite &move (int x, int y) { _x = x, _y = y; oamSetXY (_oam, _id, _x, _y); return *this ; }
55+ Sprite &palette (int palette) { _paletteAlpha = palette; oamSetPalette (_oam, _id, _paletteAlpha); return *this ; }
56+ Sprite &priority (int priority) { _priority = priority; oamSetPriority (_oam, _id, _priority); return *this ; }
57+ Sprite &rotateScale (int angle, float sx, float sy) { if (_affineIndex >= 0 && _affineIndex <= 31 ) oamRotateScale (_oam, _affineIndex, angle, FLOAT_TO_FIXED (sx), FLOAT_TO_FIXED (sy)); return *this ; }
4058 Sprite &visible (bool visible) { _visible = visible; oamSetHidden (_oam, _id, !visible); return *this ; }
41- Sprite &xy (int x, int y) { oamSetXY (_oam, _id, x, y); return *this ; }
4259};
4360
4461#endif // SPRITE_HPP
0 commit comments