Sheet of sprites.
More...
#include <th_gfx_sdl.h>
|
| | sprite_sheet ()=default |
| |
| | ~sprite_sheet () |
| |
| void | set_palette (const ::palette *pPalette) |
| | Set the palette to use for the sprites in the sheet.
|
| |
| bool | load_from_th_file (const uint8_t *pTableData, size_t iTableDataLength, const uint8_t *pChunkData, size_t iChunkDataLength, bool bComplexChunks, render_target *pEventualCanvas) |
| |
| bool | set_sprite_data (size_t iSprite, const uint8_t *pData, bool bTakeData, size_t iDataLength, int iWidth, int iHeight) |
| | Set the data of a sprite.
|
| |
| void | set_sprite_alt_palette_map (size_t iSprite, const uint8_t *pMap, uint32_t iAlt32) |
| | Supply a new mapped palette to a sprite.
|
| |
| size_t | get_sprite_count () const |
| | Get the number of sprites at the sheet.
|
| |
| bool | set_sprite_count (size_t iCount, render_target *pCanvas) |
| | Set the number of sprites in the sheet.
|
| |
| bool | get_sprite_size (size_t iSprite, int *pWidth, int *pHeight) const |
| | Get size of a sprite.
|
| |
| void | get_sprite_size_unchecked (size_t iSprite, int *pWidth, int *pHeight) const |
| | Get size of a sprite, assuming all input is correctly supplied.
|
| |
| bool | get_sprite_average_colour (size_t iSprite, argb_colour *pColour) const |
| | Get the best colour to represent the sprite.
|
| |
| bool | is_sprite_visible (size_t iSprite) const |
| | Return whether the given sprite show any pixel when displayed.
|
| |
| void | draw_sprite (render_target *pCanvas, size_t iSprite, int iX, int iY, uint32_t iFlags, size_t effect_ticks=0u, animation_effect effect=animation_effect::none, int scale_factor=1) |
| | Draw a sprite onto the canvas.
|
| |
| bool | hit_test_sprite (size_t iSprite, int iX, int iY, uint32_t iFlags) const |
| | Test whether a sprite was hit.
|
| |
| void | wx_draw_sprite (size_t iSprite, uint8_t *pRGBData, uint8_t *pAData) |
| | Draw a sprite into wxImage data arrays (for the Map Editor)
|
| |
◆ sprite_sheet()
| sprite_sheet::sprite_sheet |
( |
| ) |
|
|
default |
◆ ~sprite_sheet()
| sprite_sheet::~sprite_sheet |
( |
| ) |
|
◆ draw_sprite()
Draw a sprite onto the canvas.
- Parameters
-
| pCanvas | Canvas to draw on. |
| iSprite | Sprite to draw. |
| iX | X position to draw the sprite. |
| iY | Y position to draw the sprite. |
| iFlags | Flags to apply for drawing. |
| effect_ticks | The number of ticks into the effect animation. |
| effect | The animation effect to apply to the sprite. |
| scale_factor | How much to scale the sprite when drawing. |
◆ get_sprite_average_colour()
| bool sprite_sheet::get_sprite_average_colour |
( |
size_t |
iSprite, |
|
|
argb_colour * |
pColour |
|
) |
| const |
Get the best colour to represent the sprite.
- Parameters
-
| iSprite | Sprite number to analyze. |
| pColour | [out] Resulting colour. |
- Returns
- Best colour could be established.
◆ get_sprite_count()
| size_t sprite_sheet::get_sprite_count |
( |
| ) |
const |
Get the number of sprites at the sheet.
- Returns
- The number of sprites available at the sheet.
◆ get_sprite_size()
| bool sprite_sheet::get_sprite_size |
( |
size_t |
iSprite, |
|
|
int * |
pWidth, |
|
|
int * |
pHeight |
|
) |
| const |
Get size of a sprite.
- Parameters
-
| iSprite | Sprite to get info from. |
| pWidth | [out] If not nullptr, the sprite width is stored in the destination. |
| pHeight | [out] If not nullptr, the sprite height is stored in the destination. |
- Returns
- Size could be provided for the sprite.
◆ get_sprite_size_unchecked()
| void sprite_sheet::get_sprite_size_unchecked |
( |
size_t |
iSprite, |
|
|
int * |
pWidth, |
|
|
int * |
pHeight |
|
) |
| const |
Get size of a sprite, assuming all input is correctly supplied.
- Parameters
-
| iSprite | Sprite to get info from. |
| pWidth | [out] The sprite width is stored in the destination. |
| pHeight | [out] The sprite height is stored in the destination. |
◆ hit_test_sprite()
| bool sprite_sheet::hit_test_sprite |
( |
size_t |
iSprite, |
|
|
int |
iX, |
|
|
int |
iY, |
|
|
uint32_t |
iFlags |
|
) |
| const |
Test whether a sprite was hit.
- Parameters
-
| iSprite | Sprite being tested. |
| iX | X position of the point to test relative to the origin of the sprite. |
| iY | Y position of the point to test relative to the origin of the sprite. |
| iFlags | Draw flags to apply to the sprite before testing. |
- Returns
- Whether the sprite covers the give point.
◆ is_sprite_visible()
| bool sprite_sheet::is_sprite_visible |
( |
size_t |
iSprite | ) |
const |
Return whether the given sprite show any pixel when displayed.
- Parameters
-
| iSprite | Sprite number to analyze. |
- Returns
- Whether any pixel of the sprite is visible.
◆ load_from_th_file()
| bool sprite_sheet::load_from_th_file |
( |
const uint8_t * |
pTableData, |
|
|
size_t |
iTableDataLength, |
|
|
const uint8_t * |
pChunkData, |
|
|
size_t |
iChunkDataLength, |
|
|
bool |
bComplexChunks, |
|
|
render_target * |
pEventualCanvas |
|
) |
| |
Load the sprites from the supplied data (using the palette supplied earlier).
- Parameters
-
| pTableData | Start of table data with TH sprite information (see th_sprite_properties). |
| iTableDataLength | Length of the table data. |
| pChunkData | Start of image data (chunks). |
| iChunkDataLength | Length of the chunk data. |
| bComplexChunks | Whether the supplied chunks are 'complex'. |
| pEventualCanvas | Canvas to draw at. |
- Returns
- Loading succeeded.
◆ set_palette()
Set the palette to use for the sprites in the sheet.
- Parameters
-
| pPalette | Palette to use for the sprites at the sheet. |
◆ set_sprite_alt_palette_map()
| void sprite_sheet::set_sprite_alt_palette_map |
( |
size_t |
iSprite, |
|
|
const uint8_t * |
pMap, |
|
|
uint32_t |
iAlt32 |
|
) |
| |
Supply a new mapped palette to a sprite.
- Parameters
-
| iSprite | Sprite getting the mapped palette. |
| pMap | The palette map to apply. |
| iAlt32 | What to do for a 32bpp sprite (thdf_alt32_mask bits). |
◆ set_sprite_count()
Set the number of sprites in the sheet.
- Parameters
-
| iCount | The desired number of sprites. |
| pCanvas | Canvas to draw at. |
- Returns
- Whether the number of sprites could be allocated.
◆ set_sprite_data()
| bool sprite_sheet::set_sprite_data |
( |
size_t |
iSprite, |
|
|
const uint8_t * |
pData, |
|
|
bool |
bTakeData, |
|
|
size_t |
iDataLength, |
|
|
int |
iWidth, |
|
|
int |
iHeight |
|
) |
| |
Set the data of a sprite.
- Parameters
-
| iSprite | Number of the sprite to set. |
| pData | Data of the sprite. |
| bTakeData | Whether the data block may be taken (must be new[] then). |
| iDataLength | Length of the data. |
| iWidth | Width of the sprite. |
| iHeight | Height of the sprite. |
- Returns
- Setting the sprite succeeded.
◆ wx_draw_sprite()
| void sprite_sheet::wx_draw_sprite |
( |
size_t |
iSprite, |
|
|
uint8_t * |
pRGBData, |
|
|
uint8_t * |
pAData |
|
) |
| |
Draw a sprite into wxImage data arrays (for the Map Editor)
- Parameters
-
| iSprite | Sprite number to draw. |
| pRGBData | Output RGB data array. |
| pAData | Output Alpha channel array. |
◆ cursor
The documentation for this class was generated from the following files: