sgdk
|
VDP background plane support. More...
Go to the source code of this file.
Classes | |
struct | Image |
Image structure which contains all data to define an image in a background plane. Use the unpackImage() method to unpack if compression is enabled in TileSet or TileMap structure. More... | |
Functions | |
void | VDP_setHorizontalScroll (VDPPlane plane, s16 value) |
Set plane horizontal scroll (plain scroll mode). 3 horizontal scroll modes are supported: | |
void | VDP_setHorizontalScrollVSync (VDPPlane plane, s16 value) |
Same as VDP_setHorizontalScroll(..) except that it will delay scroll update on VSync. | |
void | VDP_setHorizontalScrollTile (VDPPlane plane, u16 tile, s16 *values, u16 len, TransferMethod tm) |
Set plane horizontal scroll (tile scroll mode). 3 horizontal scroll modes are supported: | |
void | VDP_setHorizontalScrollLine (VDPPlane plane, u16 line, s16 *values, u16 len, TransferMethod tm) |
Set plane horizontal scroll (line scroll mode). 3 horizontal scroll modes are supported: | |
void | VDP_setVerticalScroll (VDPPlane plane, s16 value) |
Set plane vertical scroll (plain scroll mode). 2 vertical scroll modes are supported: | |
void | VDP_setVerticalScrollVSync (VDPPlane plane, s16 value) |
Same as VDP_setVerticalScroll(..) except that it will delay scroll update on VSync. | |
void | VDP_setVerticalScrollTile (VDPPlane plane, u16 tile, s16 *values, u16 len, TransferMethod tm) |
Set plane vertical scroll (2-Tiles scroll mode). 2 vertical scroll modes are supported: | |
void | VDP_clearPlane (VDPPlane plane, bool wait) |
Clear specified plane (using DMA). | |
VDPPlane | VDP_getTextPlane () |
Returns the plane used to display text. | |
u16 | VDP_getTextPalette () |
Returns the palette number used to display text. | |
u16 | VDP_getTextPriority () |
Returns the priority used to display text. | |
void | VDP_setTextPlane (VDPPlane plane) |
Define the plane to use to display text. | |
void | VDP_setTextPalette (u16 palette) |
Define the palette to use to display text. | |
void | VDP_setTextPriority (u16 prio) |
Define the priority to use to display text. | |
void | VDP_drawTextEx (VDPPlane plane, const char *str, u16 basetile, u16 x, u16 y, TransferMethod tm) |
Draw text in specified plane (advanced method). | |
void | VDP_clearTextEx (VDPPlane plane, u16 basetile, u16 x, u16 y, u16 w, TransferMethod tm) |
Clear a single line portion of text (advanced method). | |
void | VDP_clearTextAreaEx (VDPPlane plane, u16 basetile, u16 x, u16 y, u16 w, u16 h, TransferMethod tm) |
Clear a specific area of text (advanced method). | |
void | VDP_drawTextBG (VDPPlane plane, const char *str, u16 x, u16 y) |
Draw text in specified plane. | |
void | VDP_clearTextBG (VDPPlane plane, u16 x, u16 y, u16 w) |
Clear a single line portion of text. | |
void | VDP_clearTextAreaBG (VDPPlane plane, u16 x, u16 y, u16 w, u16 h) |
Clear a specific area of text. | |
void | VDP_clearTextLineBG (VDPPlane plane, u16 y) |
Clear a complete line of text. | |
void | VDP_drawText (const char *str, u16 x, u16 y) |
Draw text. | |
void | VDP_clearText (u16 x, u16 y, u16 w) |
Clear a single line portion of text. | |
void | VDP_clearTextArea (u16 x, u16 y, u16 w, u16 h) |
Clear a specific area of text. | |
void | VDP_clearTextLine (u16 y) |
Clear a complete line of text. | |
bool | VDP_drawBitmap (VDPPlane plane, const Bitmap *bitmap, u16 x, u16 y) |
Draw Bitmap in specified background plane and at given position. | |
bool | VDP_drawBitmapEx (VDPPlane plane, const Bitmap *bitmap, u16 basetile, u16 x, u16 y, bool loadpal) |
Draw Bitmap in specified background plane and at given position. | |
bool | VDP_drawImage (VDPPlane plane, const Image *image, u16 x, u16 y) |
Draw Image (using DMA) in specified background plane and at given position. | |
bool | VDP_drawImageEx (VDPPlane plane, const Image *image, u16 basetile, u16 x, u16 y, bool loadpal, bool dma) |
Draw Image in specified background plane and at given position. | |
Variables | |
u16 | curTileInd |
VDP background plane support.
This unit provides plane A & plane B facilities :
Clear specified plane (using DMA).
plane | Plane we want to clear. Accepted values are:
|
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 a single line portion of text.
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
Clear a specific area of text.
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
h | heigth to clear (in tile). |
Clear a specific area of text.
plane | Plane where we want to clear text. Accepted values are:
|
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
h | heigth to clear (in tile). |
void VDP_clearTextAreaEx | ( | VDPPlane | plane, |
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
u16 | w, | ||
u16 | h, | ||
TransferMethod | tm | ||
) |
Clear a specific area of text (advanced method).
plane | Plane where we want to clear text. Accepted values are:
|
basetile | Base tile attributes data (see TILE_ATTR() macro). |
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
h | heigth to clear (in tile). |
tm | Transfer method, using DMA_QUEUE or DMA_QUEUE_COPY ensure that it will be executed during VBlank. Accepted values are:
|
Clear a single line portion of text.
plane | Plane where we want to clear text. Accepted values are:
|
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
Clear a single line portion of text (advanced method).
plane | Plane where we want to clear text. Accepted values are:
|
basetile | Base tile attributes data (see TILE_ATTR() macro). |
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
tm | Transfer method, using DMA_QUEUE or DMA_QUEUE_COPY ensure that it will be executed during VBlank. Accepted values are:
|
void VDP_clearTextLine | ( | u16 | y | ) |
Clear a complete line of text.
y | y position (in tile). |
Clear a complete line of text.
plane | Plane where we want to clear text. Accepted values are:
|
y | y position (in tile). |
Draw Bitmap in specified background plane and at given position.
plane | Plane where we want to draw the bitmap. Accepted values are:
|
bitmap | Genesis bitmap (the width and height should be aligned to 8). The Bitmap is unpacked "on the fly" if needed (require some memory). |
x | Plane X position (in tile). |
y | Plane Y position (in tile). |
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 prepared tile data.
bool VDP_drawBitmapEx | ( | VDPPlane | plane, |
const Bitmap * | bitmap, | ||
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
bool | loadpal | ||
) |
Draw Bitmap in specified background plane and at given position.
plane | Plane where we want to draw the bitmap. Accepted values are:
|
bitmap | Genesis bitmap (the width and height should be aligned to 8). The Bitmap is unpacked "on the fly" if needed (require some memory). |
basetile | Base tile attributes data (see TILE_ATTR_FULL() macro). |
x | Plane X position (in tile). |
y | Plane Y position (in tile). |
loadpal | Load the bitmap palette information when non zero (can be TRUE or FALSE) |
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 prepared tile data.
Draw Image (using DMA) in specified background plane and at given position.
plane | Plane where we want to draw the tilemap. Accepted values are:
|
image | Image structure to draw. The Image is unpacked "on the fly" if needed (require some memory). |
x | Plane X position (in tile). |
y | Plane Y position (in tile). |
Load the image tiles data in VRAM and display it at specified plane position.
bool VDP_drawImageEx | ( | VDPPlane | plane, |
const Image * | image, | ||
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
bool | loadpal, | ||
bool | dma | ||
) |
Draw Image in specified background plane and at given position.
plane | Plane where we want to load tilemap. Accepted values are:
|
image | Image structure to draw. The Image is unpacked "on the fly" if needed (require some memory). |
basetile | Base tile attributes data (see TILE_ATTR_FULL() macro). |
x | Plane X position (in tile). |
y | Plane Y position (in tile). |
loadpal | Load the bitmap palette information when non zero (can be TRUE or FALSE) |
dma | use DMA |
Load the image tiles data in VRAM and display it at specified plane position.
Draw text.
str | String to draw. |
x | X position (in tile). |
y | y position (in tile). |
Draw text in specified plane.
plane | Plane where we want to draw text. Accepted values are:
|
str | String to draw. |
x | X position (in tile). |
y | y position (in tile). |
void VDP_drawTextEx | ( | VDPPlane | plane, |
const char * | str, | ||
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
TransferMethod | tm | ||
) |
Draw text in specified plane (advanced method).
plane | Plane where we want to draw text. Accepted values are:
|
str | String to draw. |
basetile | Base tile attributes data (see TILE_ATTR() macro). |
x | X position (in tile). |
y | y position (in tile). |
tm | Transfer method, using DMA_QUEUE or DMA_QUEUE_COPY ensure that it will be executed during VBlank. Accepted values are:
|
u16 VDP_getTextPalette | ( | ) |
Returns the palette number used to display text.
VDPPlane VDP_getTextPlane | ( | ) |
Returns the plane used to display text.
Returned value should be either equals to BG_A, BG_B or WINDOW.
u16 VDP_getTextPriority | ( | ) |
Returns the priority used to display text.
Set plane horizontal scroll (plain scroll mode).
3 horizontal scroll modes are supported:
plane | Plane we want to set the horizontal scroll. Accepted values are:
|
value | H scroll offset. Negative value will move the plane to the left while positive value will move it to the right. |
void VDP_setHorizontalScrollLine | ( | VDPPlane | plane, |
u16 | line, | ||
s16 * | values, | ||
u16 | len, | ||
TransferMethod | tm | ||
) |
Set plane horizontal scroll (line scroll mode).
3 horizontal scroll modes are supported:
plane | Plane we want to set the horizontal scroll. Accepted values are:
|
line | First line we want to set the horizontal scroll. |
values | H scroll offsets. Negative values will move the plane to the left while positive values will move it to the right. |
len | Number of line to set. |
tm | Transfer method, it's recommended to use DMA_QUEUE so it will be executed as fast as possible during VBlank. Accepted values are:
|
void VDP_setHorizontalScrollTile | ( | VDPPlane | plane, |
u16 | tile, | ||
s16 * | values, | ||
u16 | len, | ||
TransferMethod | tm | ||
) |
Set plane horizontal scroll (tile scroll mode).
3 horizontal scroll modes are supported:
plane | Plane we want to set the horizontal scroll. Accepted values are:
|
tile | First tile we want to set the horizontal scroll. |
values | H scroll offsets. Negative values will move the plane to the left while positive values will move it to the right. |
len | Number of tile to set. |
tm | Transfer method, it's recommended to use DMA_QUEUE so it will be executed as fast as possible during VBlank. Accepted values are:
|
Same as VDP_setHorizontalScroll(..) except that it will delay scroll update on VSync.
plane | Plane we want to set the horizontal scroll. Accepted values are:
|
value | H scroll offset. Negative value will move the plane to the left while positive value will move it to the right. |
void VDP_setTextPalette | ( | u16 | palette | ) |
Define the palette to use to display text.
palette | Palette number. |
void VDP_setTextPlane | ( | VDPPlane | plane | ) |
Define the plane to use to display text.
plane | Plane where to display text. Accepted values are:
|
void VDP_setTextPriority | ( | u16 | prio | ) |
Define the priority to use to display text.
prio | Priority: 1 = HIGH PRIORITY TILE. 0 = LOW PRIORITY TILE. |
Set plane vertical scroll (plain scroll mode). 2 vertical scroll modes are supported:
plane | Plane we want to set the vertical scroll. Accepted values are:
|
value | V scroll offset. Negative value will move the plane down while positive value will move it up. |
void VDP_setVerticalScrollTile | ( | VDPPlane | plane, |
u16 | tile, | ||
s16 * | values, | ||
u16 | len, | ||
TransferMethod | tm | ||
) |
Set plane vertical scroll (2-Tiles scroll mode). 2 vertical scroll modes are supported:
plane | Plane we want to set the vertical scroll. Accepted values are:
|
tile | First tile we want to set the vertical scroll. |
values | V scroll offsets. Negative values will move the plane down while positive values will move it up. |
len | Number of tile to set. |
tm | Transfer method, it's recommended to use DMA_QUEUE so it will be executed as fast as possible during VBlank. Accepted values are:
|
Same as VDP_setVerticalScroll(..) except that it will delay scroll update on VSync.
plane | Plane we want to set the vertical scroll. Accepted values are:
|
value | V scroll offset. Negative value will move the plane down while positive value will move it up. |
Contains current VRAM tile position where we will upload next tile data.