sgdk
|
00001 00013 #ifndef _VDP_TILE_H_ 00014 #define _VDP_TILE_H_ 00015 00016 00017 #include "vdp.h" 00018 #include "dma.h" 00019 00020 00025 #define TILE_ATTR_PRIORITY_SFT 15 00026 00030 #define TILE_ATTR_PALETTE_SFT 13 00031 00035 #define TILE_ATTR_VFLIP_SFT 12 00036 00040 #define TILE_ATTR_HFLIP_SFT 11 00041 00045 #define TILE_ATTR_PRIORITY_MASK (1 << TILE_ATTR_PRIORITY_SFT) 00046 00050 #define TILE_ATTR_PALETTE_MASK (3 << TILE_ATTR_PALETTE_SFT) 00051 00055 #define TILE_ATTR_VFLIP_MASK (1 << TILE_ATTR_VFLIP_SFT) 00056 00060 #define TILE_ATTR_HFLIP_MASK (1 << TILE_ATTR_HFLIP_SFT) 00061 00065 #define TILE_ATTR_MASK (TILE_ATTR_PRIORITY_MASK | TILE_ATTR_PALETTE_MASK | TILE_ATTR_VFLIP_MASK | TILE_ATTR_HFLIP_MASK) 00066 00080 #define TILE_ATTR(pal, prio, flipV, flipH) (((flipH) << TILE_ATTR_HFLIP_SFT) + ((flipV) << TILE_ATTR_VFLIP_SFT) + ((pal) << TILE_ATTR_PALETTE_SFT) + ((prio) << TILE_ATTR_PRIORITY_SFT)) 00081 00096 #define TILE_ATTR_FULL(pal, prio, flipV, flipH, index) (((flipH) << TILE_ATTR_HFLIP_SFT) + ((flipV) << TILE_ATTR_VFLIP_SFT) + ((pal) << TILE_ATTR_PALETTE_SFT) + ((prio) << TILE_ATTR_PRIORITY_SFT) + (index)) 00097 00113 typedef struct 00114 { 00115 u16 compression; 00116 u16 numTile; 00117 u32 *tiles; 00118 } TileSet; 00119 00136 typedef struct 00137 { 00138 u16 compression; 00139 u16 w; 00140 u16 h; 00141 u16 *tilemap; 00142 } TileMap; 00143 00159 u16 VDP_getPlaneAddress(VDPPlane plane, u16 x, u16 y); 00160 00183 void VDP_loadTileData(const u32 *data, u16 index, u16 num, TransferMethod tm); 00209 u16 VDP_loadTileSet(const TileSet *tileset, u16 index, TransferMethod tm); 00232 void VDP_loadFontData(const u32 *font, u16 length, TransferMethod tm); 00257 u16 VDP_loadFont(const TileSet *font, TransferMethod tm); 00258 00279 void VDP_loadBMPTileData(const u32 *data, u16 index, u16 w, u16 h, u16 bmp_w); 00304 void VDP_loadBMPTileDataEx(const u32 *data, u16 index, u16 x, u16 y, u16 w, u16 h, u16 bmp_w); 00305 00322 void VDP_fillTileData(u8 value, u16 index, u16 num, bool wait); 00323 00345 void VDP_clearTileMap(u16 planeAddr, u16 ind, u16 num, bool wait); 00365 void VDP_fillTileMap(u16 planeAddr, u16 tile, u16 ind, u16 num); 00400 void VDP_setTileMapData(u16 planeAddr, const u16 *data, u16 ind, u16 num, u16 vramStep, TransferMethod tm); 00430 void VDP_setTileMapDataEx(u16 planeAddr, const u16 *data, u16 basetile, u16 ind, u16 num, u16 vramStep); 00431 00451 void VDP_setTileMapXY(VDPPlane plane, u16 tile, u16 x, u16 y); 00473 void VDP_clearTileMapRect(VDPPlane plane, u16 x, u16 y, u16 w, u16 h); 00500 void VDP_fillTileMapRect(VDPPlane plane, u16 tile, u16 x, u16 y, u16 w, u16 h); 00531 void VDP_fillTileMapRectInc(VDPPlane plane, u16 basetile, u16 x, u16 y, u16 w, u16 h); 00532 00571 void VDP_setTileMapDataRect(VDPPlane plane, const u16 *data, u16 x, u16 y, u16 w, u16 h, u16 wm, TransferMethod tm); 00615 void VDP_setTileMapDataRectEx(VDPPlane plane, const u16 *data, u16 basetile, u16 x, u16 y, u16 w, u16 h, u16 wm, TransferMethod tm); 00616 00651 void VDP_setTileMapDataRow(VDPPlane plane, const u16 *data, u16 row, u16 x, u16 w, TransferMethod tm); 00691 void VDP_setTileMapDataRowEx(VDPPlane plane, const u16 *data, u16 basetile, u16 row, u16 x, u16 w, TransferMethod tm); 00728 void VDP_setTileMapDataColumnFast(VDPPlane plane, u16* data, u16 column, u16 y, u16 h, TransferMethod tm); 00766 void VDP_setTileMapDataColumn(VDPPlane plane, const u16 *data, u16 column, u16 y, u16 h, u16 wm, TransferMethod tm); 00810 void VDP_setTileMapDataColumnEx(VDPPlane plane, const u16 *data, u16 basetile, u16 column, u16 y, u16 h, u16 wm, TransferMethod tm); 00811 00851 bool VDP_setTileMap(VDPPlane plane, const TileMap *tilemap, u16 x, u16 y, u16 w, u16 h, TransferMethod tm); 00900 bool VDP_setTileMapEx(VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 xp, u16 yp, u16 x, u16 y, u16 w, u16 h, TransferMethod tm); 00939 bool VDP_setTileMapRow(VDPPlane plane, const TileMap *tilemap, u16 row, u16 x, u16 w, TransferMethod tm); 00985 bool VDP_setTileMapRowEx(VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 row, u16 x, u16 y, u16 w, TransferMethod tm); 01025 bool VDP_setTileMapColumn(VDPPlane plane, const TileMap *tilemap, u16 column, u16 y, u16 h, TransferMethod tm); 01072 bool VDP_setTileMapColumnEx(VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 column, u16 x, u16 y, u16 h, TransferMethod tm); 01073 01078 bool VDP_setMap(VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 x, u16 y); 01083 bool VDP_setMapEx(VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 x, u16 y, u16 xm, u16 ym, u16 wm, u16 hm); 01084 01085 01086 #endif // _VDP_TILE_H_