|
coastline 0.0.4
|
The sprites of the menus: pictures loaded from the cartridge and drawn in strips, and the rectangles of solid colour drawn with them. More...
#include <PR/ultratypes.h>Go to the source code of this file.
Classes | |
| struct | Sprite |
| A picture of the menus. More... | |
Macros | |
| #define | SPRITE_STYLE_TINTED 99 |
| The style of an 8-bit sprite that draws it in the primitive colour times its texels. | |
| #define | WITH_PALETTE(value, palette) |
| An argument followed by a palette, in the releases whose sprite routines take one. | |
Functions | |
| void | LoadTextureFromRom (Sprite *sprite) |
| Allocate memory for a sprite and decompress it there from the cartridge. | |
| void | DrawSpriteAtOrigin (Sprite *sprite, u16 *palette) |
| Draw a sprite at its origin, at its size on the screen. | |
| void | DrawTexturedSprite (Sprite *sprite, s32 x, s32 y) |
| Draw a sprite at a position. | |
| void | DrawSpriteTinted (Sprite *sprite, u8 red, u8 green, u8 blue) |
| Draw a sprite at its origin in a colour. | |
| void | DrawSpriteRegion (Sprite *sprite, s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue) |
| Draw a sprite stretched over a rectangle in a colour. | |
| void | DrawSpriteStrip (Sprite *sprite, u8 *pixels, u16 *palette, s32 width, s32 height, s32 x, s32 y, s32 drawWidth, s32 drawHeight, u8 red, u8 green, u8 blue) |
| Draw one strip of a sprite stretched over a rectangle, upside down to match the bottom-up rows. | |
| void | DrawScaledTexturedRect (Sprite *sprite, s32 srcX, s32 srcY, s32 srcWidth, s32 srcHeight, s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue) |
| Draw a rectangle of the texels of a 4-bit sprite stretched over a rectangle of the screen in a colour, upside down. | |
| void | DrawPixel (s32 x, s32 y, u8 shade) |
| Fill one pixel in a grey. | |
| void | DrawRectOutline (s32 x, s32 y, s32 width, s32 height, s32 thickness, u8 red, u8 green, u8 blue) |
| Draw the outline of a rectangle in a colour, inside its edges. | |
| void | DrawFilledRectHiRes (s32 x, s32 y, s32 width, s32 height, u8 red, u8 green, u8 blue) |
| Fill a rectangle in a colour. | |
| void | DrawRectBorder (s32 x, s32 y, s32 width, s32 height, s32 border, u8 transparent, u8 sunken, u8 red, u8 green, u8 blue) |
| Draw a box with a bevelled border outside its edges, light at the top and the left and dark at the bottom and the right, or the other way round when sunken. | |
The sprites of the menus: pictures loaded from the cartridge and drawn in strips, and the rectangles of solid colour drawn with them.
| #define SPRITE_STYLE_TINTED 99 |
The style of an 8-bit sprite that draws it in the primitive colour times its texels.
| #define WITH_PALETTE | ( | value, | |
| palette ) |
An argument followed by a palette, in the releases whose sprite routines take one.
| void LoadTextureFromRom | ( | Sprite * | sprite | ) |
Allocate memory for a sprite and decompress it there from the cartridge.
A picture whose size does not match its dimensions is reported on the debug output, and the game then halts.
| sprite | The sprite to load. |
Draw a sprite at its origin, at its size on the screen.
| sprite | The sprite to draw. European and Japanese releases also take the palette of the texels, or NULL. |
| palette | The palette of the texels, or NULL. |
Draw a sprite at a position.
| sprite | The sprite to draw. |
| x | The X coordinate on the screen. |
| y | The Y coordinate on the screen. |
Draw a sprite at its origin in a colour.
Only a 4-bit sprite and a tinted 8-bit sprite take the colour.
| sprite | The sprite to draw. |
| red | The red component of the colour. |
| green | The green component of the colour. |
| blue | The blue component of the colour. |
| void DrawSpriteRegion | ( | Sprite * | sprite, |
| s32 | x, | ||
| s32 | y, | ||
| s32 | width, | ||
| s32 | height, | ||
| u8 | red, | ||
| u8 | green, | ||
| u8 | blue ) |
Draw a sprite stretched over a rectangle in a colour.
| sprite | The sprite to draw. |
| x | The left edge of the rectangle on the screen. |
| y | The top edge of the rectangle on the screen. |
| width | The width of the rectangle. |
| height | The height of the rectangle. |
| red | The red component of the colour. |
| green | The green component of the colour. |
| blue | The blue component of the colour. |
| void DrawSpriteStrip | ( | Sprite * | sprite, |
| u8 * | pixels, | ||
| u16 * | palette, | ||
| s32 | width, | ||
| s32 | height, | ||
| s32 | x, | ||
| s32 | y, | ||
| s32 | drawWidth, | ||
| s32 | drawHeight, | ||
| u8 | red, | ||
| u8 | green, | ||
| u8 | blue ) |
Draw one strip of a sprite stretched over a rectangle, upside down to match the bottom-up rows.
The depth of the sprite picks the format and the combiner. A depth other than 4, 8, or 16 loads nothing and draws the rectangle with the texture memory as it is.
| sprite | The sprite the strip belongs to. |
| pixels | The texels of the strip. European and Japanese releases also take the palette of a 4-bit strip of colour indices, or NULL for an intensity strip. |
| width | The width of the strip in texels. |
| height | The height of the strip in texels. |
| x | The left edge on the screen. |
| y | The top edge on the screen. |
| drawWidth | The width on the screen, negative to mirror the strip. |
| drawHeight | The height on the screen. |
| red | The red component of the primitive colour. |
| green | The green component of the primitive colour. |
| blue | The blue component of the primitive colour. |
| palette | The palette of a 4-bit strip of colour indices, or NULL for intensity. |
| void DrawScaledTexturedRect | ( | Sprite * | sprite, |
| s32 | srcX, | ||
| s32 | srcY, | ||
| s32 | srcWidth, | ||
| s32 | srcHeight, | ||
| s32 | x, | ||
| s32 | y, | ||
| s32 | width, | ||
| s32 | height, | ||
| u8 | red, | ||
| u8 | green, | ||
| u8 | blue ) |
Draw a rectangle of the texels of a 4-bit sprite stretched over a rectangle of the screen in a colour, upside down.
The texels loaded extend one column and one row past the source rectangle.
| sprite | The sprite to draw from. |
| srcX | The left edge of the source rectangle in texels. |
| srcY | The top edge of the source rectangle in texels. |
| srcWidth | The width of the source rectangle in texels. |
| srcHeight | The height of the source rectangle in texels. |
| x | The left edge on the screen. |
| y | The top edge on the screen. |
| width | The width on the screen. |
| height | The height on the screen. |
| red | The red component of the colour. |
| green | The green component of the colour. |
| blue | The blue component of the colour. |
Fill one pixel in a grey.
| x | The X coordinate on the screen. |
| y | The Y coordinate on the screen. |
| shade | The level of the grey. |
| void DrawRectOutline | ( | s32 | x, |
| s32 | y, | ||
| s32 | width, | ||
| s32 | height, | ||
| s32 | thickness, | ||
| u8 | red, | ||
| u8 | green, | ||
| u8 | blue ) |
Draw the outline of a rectangle in a colour, inside its edges.
| x | The left edge on the screen. |
| y | The top edge on the screen. |
| width | The width. |
| height | The height. |
| thickness | The thickness of the outline, at least 1 once the screen scale applies. |
| red | The red component of the colour. |
| green | The green component of the colour. |
| blue | The blue component of the colour. |
Fill a rectangle in a colour.
A width or height under 1 once the screen scale applies is 1.
| x | The left edge on the screen. |
| y | The top edge on the screen. |
| width | The width. |
| height | The height. |
| red | The red component of the colour. |
| green | The green component of the colour. |
| blue | The blue component of the colour. |
| void DrawRectBorder | ( | s32 | x, |
| s32 | y, | ||
| s32 | width, | ||
| s32 | height, | ||
| s32 | border, | ||
| u8 | transparent, | ||
| u8 | sunken, | ||
| u8 | red, | ||
| u8 | green, | ||
| u8 | blue ) |
Draw a box with a bevelled border outside its edges, light at the top and the left and dark at the bottom and the right, or the other way round when sunken.
| x | The left edge of the box. |
| y | The top edge of the box. |
| width | The width of the box. |
| height | The height of the box. |
| border | The width of the border, at least 1 once the screen scale applies. |
| transparent | Whether the inside of the box is not filled. |
| sunken | 1 to swap the light and the dark shades of the border. |
| red | The red component of the colour inside the box. |
| green | The green component of the colour inside the box. |
| blue | The blue component of the colour inside the box. |