sgdk
|
VDP General Tile / Tilemap operations. More...
Go to the source code of this file.
Classes | |
struct | TileSet |
Tile set structure which contains tiles definition. Use the unpackTileSet() method to unpack if compression is enabled. More... | |
struct | TileMap |
TileMap structure which contains tilemap background definition. Use the unpackTileMap() method to unpack if compression is enabled. More... | |
Defines | |
#define | TILE_ATTR_PRIORITY_SFT 15 |
Bit shift for the tile priority attribute in tilemap data. | |
#define | TILE_ATTR_PALETTE_SFT 13 |
Bit shift for the tile palette attribute in tilemap data. | |
#define | TILE_ATTR_VFLIP_SFT 12 |
Bit shift for the tile V flip attribute in tilemap data. | |
#define | TILE_ATTR_HFLIP_SFT 11 |
Bit shift for the tile H flip attribute in tilemap data. | |
#define | TILE_ATTR_PRIORITY_MASK (1 << TILE_ATTR_PRIORITY_SFT) |
Mask for the tile priority attribute in tilemap data. | |
#define | TILE_ATTR_PALETTE_MASK (3 << TILE_ATTR_PALETTE_SFT) |
Mask for the tile palette attribute in tilemap data. | |
#define | TILE_ATTR_VFLIP_MASK (1 << TILE_ATTR_VFLIP_SFT) |
Mask for the tile V flip attribute in tilemap data. | |
#define | TILE_ATTR_HFLIP_MASK (1 << TILE_ATTR_HFLIP_SFT) |
Mask for the tile H flip attribute in tilemap data. | |
#define | TILE_ATTR_MASK (TILE_ATTR_PRIORITY_MASK | TILE_ATTR_PALETTE_MASK | TILE_ATTR_VFLIP_MASK | TILE_ATTR_HFLIP_MASK) |
Mask for the tile attributes (priority, palette and flip) in tilemap data. | |
#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)) |
Encode tile attributes for tilemap data. | |
#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)) |
Encode tile attributes for tilemap data. | |
Functions | |
u16 | VDP_getPlaneAddress (VDPPlane plane, u16 x, u16 y) |
Return the VRAM tilemap address for the specified plane position. | |
void | VDP_loadTileData (const u32 *data, u16 index, u16 num, TransferMethod tm) |
Load tile data (pattern) in VRAM. | |
u16 | VDP_loadTileSet (const TileSet *tileset, u16 index, TransferMethod tm) |
Load tile data (pattern) in VRAM. | |
void | VDP_loadFontData (const u32 *font, u16 length, TransferMethod tm) |
Load font tile data in VRAM. Note that you should prefer the VDP_loadBMPFont(..) method to this one (easier to use). | |
u16 | VDP_loadFont (const TileSet *font, TransferMethod tm) |
Load font from the specified TileSet structure. | |
void | VDP_loadBMPTileData (const u32 *data, u16 index, u16 w, u16 h, u16 bmp_w) |
Load 4bpp bitmap tile data in VRAM. | |
void | VDP_loadBMPTileDataEx (const u32 *data, u16 index, u16 x, u16 y, u16 w, u16 h, u16 bmp_w) |
Load 4bpp bitmap tile data in VRAM. | |
void | VDP_fillTileData (u8 value, u16 index, u16 num, bool wait) |
Fill tile data in VRAM. | |
void | VDP_clearTileMap (u16 planeAddr, u16 ind, u16 num, bool wait) |
Clear tilemap. | |
void | VDP_fillTileMap (u16 planeAddr, u16 tile, u16 ind, u16 num) |
Fill tilemap. | |
void | VDP_setTileMapData (u16 planeAddr, const u16 *data, u16 ind, u16 num, u16 vramStep, TransferMethod tm) |
Set tilemap data at specified index. | |
void | VDP_setTileMapDataEx (u16 planeAddr, const u16 *data, u16 basetile, u16 ind, u16 num, u16 vramStep) |
Set tilemap data at specified index (extended version). | |
void | VDP_setTileMapXY (VDPPlane plane, u16 tile, u16 x, u16 y) |
Set tilemap data (single position). | |
void | VDP_clearTileMapRect (VDPPlane plane, u16 x, u16 y, u16 w, u16 h) |
Clear specified region of tilemap. | |
void | VDP_fillTileMapRect (VDPPlane plane, u16 tile, u16 x, u16 y, u16 w, u16 h) |
Fill speficied region of tilemap. | |
void | VDP_fillTileMapRectInc (VDPPlane plane, u16 basetile, u16 x, u16 y, u16 w, u16 h) |
Fill tilemap with index auto increment at specified region. | |
void | VDP_setTileMapDataRect (VDPPlane plane, const u16 *data, u16 x, u16 y, u16 w, u16 h, u16 wm, TransferMethod tm) |
Set tilemap data for specified region. | |
void | VDP_setTileMapDataRectEx (VDPPlane plane, const u16 *data, u16 basetile, u16 x, u16 y, u16 w, u16 h, u16 wm, TransferMethod tm) |
Set tilemap data for specified region (extended version). | |
void | VDP_setTileMapDataRow (VDPPlane plane, const u16 *data, u16 row, u16 x, u16 w, TransferMethod tm) |
Set a row of tilemap data. | |
void | VDP_setTileMapDataRowEx (VDPPlane plane, const u16 *data, u16 basetile, u16 row, u16 x, u16 w, TransferMethod tm) |
Set a row of tilemap data - extended version. | |
void | VDP_setTileMapDataColumnFast (VDPPlane plane, u16 *data, u16 column, u16 y, u16 h, TransferMethod tm) |
Set a complete column of pre-arranged tilemap data (not supported when plane width is set to 128). | |
void | VDP_setTileMapDataColumn (VDPPlane plane, const u16 *data, u16 column, u16 y, u16 h, u16 wm, TransferMethod tm) |
Set a column of tilemap data (not supported when plane width is set to 128). | |
void | VDP_setTileMapDataColumnEx (VDPPlane plane, const u16 *data, u16 basetile, u16 column, u16 y, u16 h, u16 wm, TransferMethod tm) |
Set a column of tilemap data - extended version (not supported when plane width is set to 128). | |
bool | VDP_setTileMap (VDPPlane plane, const TileMap *tilemap, u16 x, u16 y, u16 w, u16 h, TransferMethod tm) |
Load tilemap region. | |
bool | VDP_setTileMapEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 xp, u16 yp, u16 x, u16 y, u16 w, u16 h, TransferMethod tm) |
Load tilemap region at specified plane position. | |
bool | VDP_setTileMapRow (VDPPlane plane, const TileMap *tilemap, u16 row, u16 x, u16 w, TransferMethod tm) |
Load tilemap row. | |
bool | VDP_setTileMapRowEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 row, u16 x, u16 y, u16 w, TransferMethod tm) |
Load tilemap row (extended version). | |
bool | VDP_setTileMapColumn (VDPPlane plane, const TileMap *tilemap, u16 column, u16 y, u16 h, TransferMethod tm) |
Load tilemap column (not supported when plane width is set to 128). | |
bool | VDP_setTileMapColumnEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 column, u16 x, u16 y, u16 h, TransferMethod tm) |
Load tilemap column - extended version (not supported when plane width is set to 128). | |
bool | VDP_setMap (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 x, u16 y) |
bool | VDP_setMapEx (VDPPlane plane, const TileMap *tilemap, u16 basetile, u16 x, u16 y, u16 xm, u16 ym, u16 wm, u16 hm) |
VDP General Tile / Tilemap operations.
This unit provides methods to manipulate VDP tiles and tilemap :
#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)) |
Encode tile attributes for tilemap data.
pal | Palette index |
prio | Tile priority |
flipV | Vertical flip |
flipH | Horizontal flip |
#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)) |
Encode tile attributes for tilemap data.
pal | Palette index |
prio | Tile priority |
flipV | Vertical flip |
flipH | Horizontal flip |
index | Tile index |
Clear tilemap.
planeAddr | Plane address where we want to clear tilemap. Accepted values are:
|
ind | Tile index where to start clear. |
num | Number of tile to clear. |
wait | Wait the operation to complete when set to TRUE otherwise it returns immediately but then you will require to wait for DMA completion (DMA_waitCompletion()) before accessing the VDP. |
Clear specified region of tilemap.
plane | Plane where we want to clear tilemap region. Accepted values are:
|
x | Region X start position (in tile). |
y | Region Y start position (in tile). |
w | Region Width (in tile). |
h | Region Heigh (in tile). |
Fill tile data in VRAM.
value | Value (byte) used to fill VRAM tile data. |
index | Tile index where start tile data fill (use TILE_USERINDEX as base user index). |
num | Number of tile to fill. |
wait | Wait the operation to complete when set to TRUE otherwise it returns immediately but then you will require to wait for DMA completion (DMA_waitCompletion()) before accessing the VDP. |
This function is generally used to clear tile data in VRAM.
Fill tilemap.
planeAddr | Plane address where we want to fill tilemap. Accepted values are:
|
tile | Tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros). |
ind | tile index where to start fill. |
num | Number of tile to fill. |
Fill speficied region of tilemap.
plane | Plane where we want to fill tilemap region. Accepted values are:
|
tile | tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros). |
x | Region X start position (in tile). |
y | Region Y start position (in tile). |
w | Region Width (in tile). |
h | Region Heigh (in tile). |
Fill the specified tilemap region with specified tile attributes value.
Fill tilemap with index auto increment at specified region.
plane | Plane where we want to fill tilemap region. Accepted values are:
|
basetile | Base tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros). |
x | Region X start position (in tile). |
y | Region Y start position (in tile). |
w | Region Width (in tile). |
h | Region Heigh (in tile). |
Set the specified tilemap region with specified tile attributes value.
The function auto increments tile index in tile attributes like this:
tilemap line 0 : basetile, basetile+1, basetile+2, basetile+3, ...
tilemap line 1 : basetile+w, basetile+w+1, basetile+w+2, ...
...
So this function is convenient to display generated image or simulate a frame buffer.
Return the VRAM tilemap address for the specified plane position.
plane | Plane we want to get the VRAM tilemap address for a given position. Accepted values are:
|
x | X position (in tile). |
y | Y position (in tile). |
Load 4bpp bitmap tile data in VRAM.
data | Pointer to 4bpp bitmap tile data. |
index | Tile index where start tile data load (use TILE_USERINDEX as base user index). |
w | Width of bitmap region to load (in tile). |
h | Heigh of bitmap region to load (in tile). |
bmp_w | Width of bitmap (in tile), it can differ from 'w' parameter. |
This function does "on the fly" 4bpp bitmap conversion to tile data and transfert them to VRAM.
It's very helpful when you use bitmap images but the conversion eats sometime so you should use it only for static screen only.
For "in-game" condition you should use VDP_loadTileData() method with converted tile data.
See also VDP_loadBMPTileDataEx().
Load 4bpp bitmap tile data in VRAM.
data | Pointer to 4bpp bitmap tile data. |
index | Tile index where start tile data load (use TILE_USERINDEX as base user index). |
x | X start position of bitmap region to load (in tile). |
y | Y start position of bitmap region to load (in tile). |
w | Width of bitmap region to load (in tile). |
h | Heigh of bitmap region to load (in tile). |
bmp_w | Width of bitmap (in tile), it can differ from 'w' parameter. |
This function does "on the fly" 4bpp bitmap conversion to tile data and transfert them to VRAM.
It's very helpful when you use bitmap images but the conversion eats sometime so you should use it only for static screen only.
For "in-game" condition you should use VDP_loadTileData() method with converted tile data. See also VDP_loadBMPTileData()
u16 VDP_loadFont | ( | const TileSet * | font, |
TransferMethod | tm | ||
) |
Load font from the specified TileSet structure.
font | TileSet containing the font. The TileSet is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
tm | Transfer method. Accepted values are:
|
This fonction permits to replace system font by user font.
The font tile data are loaded to TILE_FONTINDEX and can contains FONT_LEN characters at max.
Each character should fit in one tile (8x8 pixels bloc).
See also VDP_loadFontData(..)
void VDP_loadFontData | ( | const u32 * | font, |
u16 | length, | ||
TransferMethod | tm | ||
) |
Load font tile data in VRAM.
Note that you should prefer the VDP_loadBMPFont(..) method to this one (easier to use).
font | Pointer to font tile data. |
length | Number of characters of the font (max = FONT_LEN). |
tm | Transfer method. Accepted values are:
|
This fonction permits to replace system font by user font.
The font tile data are loaded to TILE_FONTINDEX and can contains FONT_LEN characters at max.
Each character should fit in one tile (8x8 pixels bloc).
See also VDP_loadFont(..) and VDP_loadTileData(..)
void VDP_loadTileData | ( | const u32 * | data, |
u16 | index, | ||
u16 | num, | ||
TransferMethod | tm | ||
) |
Load tile data (pattern) in VRAM.
data | Pointer to tile data. |
index | Tile index where start tile data load (use TILE_USERINDEX as base user index). |
num | Number of tile to load. |
tm | Transfer method. Accepted values are:
|
Transfert rate:
~90 bytes per scanline in software (during blanking)
~190 bytes per scanline in hardware (during blanking)
u16 VDP_loadTileSet | ( | const TileSet * | tileset, |
u16 | index, | ||
TransferMethod | tm | ||
) |
Load tile data (pattern) in VRAM.
tileset | Pointer to TileSet structure. The TileSet is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
index | Tile index where start tile data load (use TILE_USERINDEX as base user index). |
tm | Transfer method. Accepted values are:
|
Transfert rate:
~90 bytes per scanline in software (during blanking)
~190 bytes per scanline in hardware (during blanking)
bool VDP_setMapEx | ( | VDPPlane | plane, |
const TileMap * | tilemap, | ||
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
u16 | xm, | ||
u16 | ym, | ||
u16 | wm, | ||
u16 | hm | ||
) |
bool VDP_setTileMap | ( | VDPPlane | plane, |
const TileMap * | tilemap, | ||
u16 | x, | ||
u16 | y, | ||
u16 | w, | ||
u16 | h, | ||
TransferMethod | tm | ||
) |
Load tilemap region.
plane | Plane where we want to load tilemap. Accepted values are:
|
tilemap | Source tilemap to load. The TileMap is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
x | Region X start position (in tile). |
y | Region Y start position (in tile). |
w | Region Width (in tile). |
h | Region Heigh (in tile). |
tm | Transfer method. Accepted values are:
|
Load the specified tilemap region at equivalent plane position (tilemap wrapping supported).
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapEx(..) which allow to override base tile attributes though the 'basetile' parameter.
bool VDP_setTileMapColumn | ( | VDPPlane | plane, |
const TileMap * | tilemap, | ||
u16 | column, | ||
u16 | y, | ||
u16 | h, | ||
TransferMethod | tm | ||
) |
Load tilemap column (not supported when plane width is set to 128).
plane | Plane where we want to load tilemap. Accepted values are:
|
tilemap | Source tilemap to set column from. The TileMap is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
column | Plane column we want to set data |
y | Source tilemap Y start position (in tile). |
h | Column height to update (in tile) |
tm | Transfer method. Accepted values are:
|
Load a complete column of data from tilemap at equivalent plane position (wrapped around if needed).
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapColumnEx(..) which allow to override base tile attributes though the 'basetile' parameter.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)
bool VDP_setTileMapColumnEx | ( | VDPPlane | plane, |
const TileMap * | tilemap, | ||
u16 | basetile, | ||
u16 | column, | ||
u16 | x, | ||
u16 | y, | ||
u16 | h, | ||
TransferMethod | tm | ||
) |
Load tilemap column - extended version (not supported when plane width is set to 128).
plane | Plane where we want to load tilemap. Accepted values are:
|
tilemap | Source tilemap to set column from. The TileMap is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro). |
column | Plane column we want to set data |
x | Source tilemap X / column position (in tile), can be different than plane column if desired. |
y | Source tilemap Y start position (in tile). |
h | Column height to update (in tile) |
tm | Transfer method. Accepted values are:
|
Load a complete column of data from tilemap at equivalent plane position (wrapped around if needed).
Unlike VDP_setTileMapColumn(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapColumn(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)
void VDP_setTileMapData | ( | u16 | planeAddr, |
const u16 * | data, | ||
u16 | ind, | ||
u16 | num, | ||
u16 | vramStep, | ||
TransferMethod | tm | ||
) |
Set tilemap data at specified index.
planeAddr | Plane address where we want to set tilemap data. Accepted values are:
|
data | Tile attributes data (see TILE_ATTR_FULL() and TILE_ATTR() macros). |
ind | Tile index where to start to set tilemap data. |
num | Number of tile to set. |
vramStep | VRAM address increment after each write (default value = 2) |
tm | Transfer method. Accepted values are:
|
Set the specified tilemap with specified tile attributes values.
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataEx(..) which allow to override base tile attributes though the 'basetile' parameter.
void VDP_setTileMapDataColumn | ( | VDPPlane | plane, |
const u16 * | data, | ||
u16 | column, | ||
u16 | y, | ||
u16 | h, | ||
u16 | wm, | ||
TransferMethod | tm | ||
) |
Set a column of tilemap data (not supported when plane width is set to 128).
plane | Plane where we want to set tilemap data. Accepted values are:
|
data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro). |
column | Plane column we want to set data |
y | Column Y start position (in tile) |
h | Column height to update (in tile) |
wm | Source tilemap width (in tile). |
tm | Transfer method. Accepted values are:
|
Set a column of tilemap data (tilemap wrapping supported) with given tile attributes values.
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base tile attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataColumnEx(..) which allow to override base tile attributes though the 'basetile' parameter.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)
void VDP_setTileMapDataColumnEx | ( | VDPPlane | plane, |
const u16 * | data, | ||
u16 | basetile, | ||
u16 | column, | ||
u16 | y, | ||
u16 | h, | ||
u16 | wm, | ||
TransferMethod | tm | ||
) |
Set a column of tilemap data - extended version (not supported when plane width is set to 128).
plane | Plane where we want to set tilemap data. Accepted values are:
|
data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro). |
basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro). |
column | Plane column we want to set data |
y | Column Y start position (in tile) |
h | Column height to update (in tile) |
wm | Source tilemap width (in tile). |
tm | Transfer method. Accepted values are:
|
Set a column of tilemap data (tilemap wrapping supported) with given tile attributes values.
Unlike VDP_setTileMapDataColumn(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapDataColumn(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation. WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method)
void VDP_setTileMapDataColumnFast | ( | VDPPlane | plane, |
u16 * | data, | ||
u16 | column, | ||
u16 | y, | ||
u16 | h, | ||
TransferMethod | tm | ||
) |
Set a complete column of pre-arranged tilemap data (not supported when plane width is set to 128).
plane | Plane where we want to set tilemap data. Accepted values are:
|
data | Prepared tile attributes data (see TILE_ATTR_FULL() macro). Column data are already arranged to be transferred as a single contiguous data block. |
column | Plane column we want to set data |
y | Column Y start position (in tile) |
h | Column height to update (in tile) |
tm | Transfer method. Accepted values are:
|
Set a complete column of tilemap data with given tile attributes values.
This method is faster than VDP_setTileMapDataColumn(..) or VDP_setTileMapDataColumnEx(..) as it assumes
that data buffer is properly prepared and arranged to be directly copied as it.
WARNING: this function doesn't work when plane width is set to 128 (see VDP_setPlaneSize(..) method).
void VDP_setTileMapDataEx | ( | u16 | planeAddr, |
const u16 * | data, | ||
u16 | basetile, | ||
u16 | ind, | ||
u16 | num, | ||
u16 | vramStep | ||
) |
Set tilemap data at specified index (extended version).
planeAddr | Plane where we want to set tilemap data. Accepted values are:
|
data | Tile attributes data (see TILE_ATTR_FULL() and TILE_ATTR() macros). |
basetile | Base tile index and flag for tile attributes (see TILE_ATTR_FULL() macro). |
ind | Tile index where to start to set tilemap data. |
num | Number of tile to set. |
vramStep | VRAM address increment after each write (default value = 2). |
Set the specified tilemap with specified tile attributes values.
Unlike VDP_setTileMapData(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapData(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.
void VDP_setTileMapDataRect | ( | VDPPlane | plane, |
const u16 * | data, | ||
u16 | x, | ||
u16 | y, | ||
u16 | w, | ||
u16 | h, | ||
u16 | wm, | ||
TransferMethod | tm | ||
) |
Set tilemap data for specified region.
plane | Plane where we want to set tilemap data. Accepted values are:
|
data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro). |
x | Region X start position (in tile). |
y | Region Y start position (in tile). |
w | Region Width (in tile). |
h | Region Heigh (in tile). |
wm | Source tilemap width (in tile). |
tm | Transfer method. Accepted values are:
|
Set the specified tilemap region (tilemap wrapping supported) with specified tile attributes values.
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataRectEx(..) which allow to override base tile attributes though the 'basetile' parameter.
void VDP_setTileMapDataRectEx | ( | VDPPlane | plane, |
const u16 * | data, | ||
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
u16 | w, | ||
u16 | h, | ||
u16 | wm, | ||
TransferMethod | tm | ||
) |
Set tilemap data for specified region (extended version).
plane | Plane where we want to set tilemap data. Accepted values are:
|
data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro). |
basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro). |
x | Region X start position (in tile). |
y | Region Y start position (in tile). |
w | Region Width (in tile). |
h | Region Heigh (in tile). |
wm | Source tilemap width (in tile). |
tm | Transfer method. Accepted values are:
|
Set the specified tilemap region (tilemap wrapping supported) with specified tile attributes values.
Unlike VDP_setTileMapDataRect(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapDataRect(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.
void VDP_setTileMapDataRow | ( | VDPPlane | plane, |
const u16 * | data, | ||
u16 | row, | ||
u16 | x, | ||
u16 | w, | ||
TransferMethod | tm | ||
) |
Set a row of tilemap data.
plane | Plane where we want to set tilemap data. Accepted values are:
|
data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro). |
row | Plane row we want to set data |
x | Row X start position (in tile) |
w | Row width to update (in tile) |
tm | Transfer method. Accepted values are:
|
Set a row of tilemap data (tilemap wrapping supported) with given tile attributes values. You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapDataRowEx(..) which allow to override base tile attributes though the 'basetile' parameter.
void VDP_setTileMapDataRowEx | ( | VDPPlane | plane, |
const u16 * | data, | ||
u16 | basetile, | ||
u16 | row, | ||
u16 | x, | ||
u16 | w, | ||
TransferMethod | tm | ||
) |
Set a row of tilemap data - extended version.
plane | Plane where we want to set tilemap data. Accepted values are:
|
data | Source tilemap data containing tile attributes (see TILE_ATTR_FULL() macro). |
basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro). |
row | Plane row we want to set data |
x | Row X start position (in tile) |
w | Row width to update (in tile) |
tm | Transfer method. Accepted values are:
|
Set a row of tilemap data (tilemap wrapping supported) with given tile attributes values.
Unlike VDP_setTileMapDataRow(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapDataRow(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.
bool VDP_setTileMapEx | ( | VDPPlane | plane, |
const TileMap * | tilemap, | ||
u16 | basetile, | ||
u16 | xp, | ||
u16 | yp, | ||
u16 | x, | ||
u16 | y, | ||
u16 | w, | ||
u16 | h, | ||
TransferMethod | tm | ||
) |
Load tilemap region at specified plane position.
plane | Plane where we want to load tilemap. Accepted values are:
|
tilemap | Source tilemap to load. The TileMap is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro). |
xp | Plane X destination position (in tile). |
yp | Plane Y destination position (in tile). |
x | Region X start position (in tile). |
y | Region Y start position (in tile). |
w | Region Width (in tile). |
h | Region Heigh (in tile). |
tm | Transfer method. Accepted values are:
|
Load the specified tilemap region at specified plane position (tilemap wrapping supported).
Unlike VDP_setTileMap(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMap(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.
bool VDP_setTileMapRow | ( | VDPPlane | plane, |
const TileMap * | tilemap, | ||
u16 | row, | ||
u16 | x, | ||
u16 | w, | ||
TransferMethod | tm | ||
) |
Load tilemap row.
plane | Plane where we want to load tilemap. Accepted values are:
|
tilemap | Source tilemap to set row from. The TileMap is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
row | Plane row we want to set data |
x | Source tilemap X start position (in tile). |
w | Row width to update (in tile) |
tm | Transfer method. Accepted values are:
|
Load a complete row of data from tilemap at equivalent plane position (wrapped around if needed).
You can use this method when you are using the 'mapbase' parameter on your resource definition to set the base attributes
(palette, priority and base tile index) so you don't need to provide them here.
This method is faster than using VDP_setTileMapRowEx(..) which allow to override base tile attributes though the 'basetile' parameter.
bool VDP_setTileMapRowEx | ( | VDPPlane | plane, |
const TileMap * | tilemap, | ||
u16 | basetile, | ||
u16 | row, | ||
u16 | x, | ||
u16 | y, | ||
u16 | w, | ||
TransferMethod | tm | ||
) |
Load tilemap row (extended version).
plane | Plane where we want to load tilemap. Accepted values are:
|
tilemap | Source tilemap to set row from. The TileMap is unpacked "on-the-fly" if needed (require some memory). Using DMA_QUEUE for packed resource is unsafe as the resource will be released and eventually can be overwritten before DMA operation so use DMA_QUEUE_COPY in that case or unpack the resource first. |
basetile | Base index and flag for tile attributes (see TILE_ATTR_FULL() macro). |
row | Plane row we want to set data |
x | Source tilemap X start position (in tile) |
y | Source tilemap Y / row position (in tile), can be different that plane row if desired. |
w | Row width to update (in tile) |
tm | Transfer method. Accepted values are:
|
Load a complete row of data from tilemap at equivalent plane position (wrapped around if needed).
Unlike VDP_setTileMapRow(..) this method let you to override the base tile attributes (priority, palette and base index)
at the expense of more computation time. If you want faster tilemap processing (using VDP_setTileMapRow(..)), you can use
the 'mapbase' parameter when declaring your IMAGE resource to set base tile attributes but then you have fixed/static tile allocation.
Set tilemap data (single position).
plane | Plane where we want to set tilemap data. Accepted values are:
|
tile | tile attributes (see TILE_ATTR_FULL() and TILE_ATTR() macros). |
x | X position (in tile). |
y | y position (in tile). |
Set the specified tilemap position (tilemap wrapping supported) with given tile attributes.