sgdk
vdp_spr.h
Go to the documentation of this file.
00001 
00011 #include "config.h"
00012 #include "types.h"
00013 #include "dma.h"
00014 
00015 #ifndef _VDP_SPR_H_
00016 #define _VDP_SPR_H_
00017 
00022 #define SAT_MAX_SIZE            80
00023 
00033 #define SPRITE_SIZE(w, h)   ((((w) - 1) << 2) | ((h) - 1))
00034 
00035 
00065 typedef struct
00066 {
00067     s16 y;  // 10 bits
00068     union
00069     {
00070         struct
00071         {
00072             u16 unused1  : 4;
00073             u16 sizeH    : 2;
00074             u16 sizeV    : 2;
00075             u16 unused2  : 1;
00076             u16 linkData : 7;
00077         };
00078         struct
00079         {
00080             u8 size;
00081             u8 link;
00082         };
00083         u16 size_link;
00084     };
00085     union
00086     {
00087         u16 attribut;
00088         struct
00089         {
00090             u16 priority : 1;
00091             u16 palette  : 2;
00092             u16 flipV    : 1;
00093             u16 flipH    : 1;
00094             u16 tile     : 11;
00095         };
00096     };
00097     s16 x;  // 10 bits
00098 }  VDPSprite;
00099 
00100 
00104 extern VDPSprite vdpSpriteCache[SAT_MAX_SIZE + 16];
00105 
00110 extern VDPSprite* lastAllocatedVDPSprite;
00120 extern s16 highestVDPSpriteIndex;
00121 
00122 
00127 void VDP_resetSprites(void);
00128 
00133 void VDP_releaseAllSprites(void);
00134 
00155 s16 VDP_allocateSprites(u16 num);
00171 void VDP_releaseSprites(u16 index, u16 num);
00181 u16 VDP_getAvailableSprites(void);
00192 s16 VDP_refreshHighestAllocatedSpriteIndex(void);
00193 
00198 void VDP_clearSprites(void);
00220 void VDP_setSpriteFull(u16 index, s16 x, s16 y, u8 size, u16 attribut, u8 link);
00239 void VDP_setSprite(u16 index, s16 x, s16 y, u8 size, u16 attribut);
00254 void VDP_setSpritePosition(u16 index, s16 x, s16 y);
00267 void VDP_setSpriteSize(u16 index, u8 size);
00280 void VDP_setSpriteAttribut(u16 index, u16 attribut);
00293 void VDP_setSpriteLink(u16 index, u8 link);
00306 VDPSprite* VDP_linkSprites(u16 index, u16 num);
00307 
00326 void VDP_updateSprites(u16 num, TransferMethod tm);
00339 void VDP_setSpritePriority(u16 index, bool priority);
00347 bool VDP_getSpritePriority(u16 index);
00360 void VDP_setSpritePalette(u16 index, u16 palette);
00368 u16 VDP_getSpritePalette(u16 index);
00383 void VDP_setSpriteFlip(u16 index, bool flipH, bool flipV);
00396 void VDP_setSpriteFlipH(u16 index, bool flipH);
00409 void VDP_setSpriteFlipV(u16 index, bool flipV);
00417 bool VDP_getSpriteFlipH(u16 index);
00425 bool VDP_getSpriteFlipV(u16 index);
00438 void VDP_setSpriteTile(u16 index, u16 tile);
00446 u16 VDP_getSpriteTile(u16 index);
00447 
00448 #endif // _VDP_SPR_H_
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines