|
libmsx
C library for MSX
|
Display Animated Color Sprites. More...
Collaboration diagram for SM2 display Animated Color Sprites.:Functions | |
| void | sm2_flush (void) |
MSX2 Display the sprite cels registered in the internal buffer. | |
| void | sm2_add_sprite (const sm2_Sprite *s, int x, int y) |
MSX2 Add the cels of the current frame of the sprite object to the internal buffer. | |
| void | sm2_add_cel (const sm2_Cel *cel, int x, int y) |
MSX2 Add a sprite cel to the internal buffer. | |
| void | sm2_reserve (uint8_t n) |
MSX2 Reserves some sprite planes for direct access. | |
| uint8_t | sm2_get_reserved (void) |
MSX2 Returns the number of reserved sprite planes. | |
| void | sm2_put_sprite (uint8_t base_plane, const sm2_Sprite *s, int x, int y) |
MSX2 Display the cels of the current frame of the sprite object. | |
| void | sm2_put_cel (uint8_t base_plane, const sm2_Cel *cel, int x, int y) |
MSX2 Display the sprite cel. | |
Display Animated Color Sprites.
| void sm2_flush | ( | void | ) |
MSX2 Display the sprite cels registered in the internal buffer.
Display (write to VRAM) all sprite cels registered in the internal buffer by sm2_add_sprite() or sm2_add_cel(). After that the buffer is cleared.
| void sm2_add_sprite | ( | const sm2_Sprite * | s, |
| int | x, | ||
| int | y ) |
MSX2 Add the cels of the current frame of the sprite object to the internal buffer.
| s | Sprite object. |
| x | X-coordinate. |
| y | Y-coordinate. |
| void sm2_add_cel | ( | const sm2_Cel * | cel, |
| int | x, | ||
| int | y ) |
MSX2 Add a sprite cel to the internal buffer.
| cel | Sprite cel. |
| x | X-coordinate. |
| y | Y-coordinate. |
| void sm2_reserve | ( | uint8_t | n | ) |
MSX2 Reserves some sprite planes for direct access.
V9938 / V9958 VDP has 32 sprite planes for displaying sprites.
To display a multicolor sprite (sm2_Sprite or sm2_Cel), multiple sprite planes are required. Normally, the SM2 module assigns a sprite plane to each sprite cel in the call order of sm2_add_sprite() or sm2_add_cel().
However, the application developer may wish to specify the sprite plane number directly.
In such a case, the sprite plane can be reserved by calling this function. To place a sprite in the reserved sprite plane directly, use sm2_put_sprite() or sm2_put_cel() after sm2_reserve().
The number of reserved sprite planes is initially set to 0.
| n | The number of reserved sprite planes. (0 <= n <= 32) |
| uint8_t sm2_get_reserved | ( | void | ) |
MSX2 Returns the number of reserved sprite planes.
| void sm2_put_sprite | ( | uint8_t | base_plane, |
| const sm2_Sprite * | s, | ||
| int | x, | ||
| int | y ) |
MSX2 Display the cels of the current frame of the sprite object.
The plane numbers from base_plane to base_plane + N - 1 must be reserved (i.e., base_plane + N < sm2_get_reserved()). Otherwise, nothing is done.
Here, N is the sum of the depths of all cels in the current frame of the sprite.
| base_plane | The 1st plane number. |
| s | Sprite object. |
| x | X-coordinate. |
| y | Y-coordinate. |
| void sm2_put_cel | ( | uint8_t | base_plane, |
| const sm2_Cel * | cel, | ||
| int | x, | ||
| int | y ) |
MSX2 Display the sprite cel.
The plane numbers from base_plane to base_plane + cel->depth - 1 must be reserved (i.e., base_plane + cel->depth < sm2_get_reserved()). Otherwise, nothing is done.
| base_plane | The 1st plane number. |
| cel | Sprite cel. |
| x | X-coordinate. |
| y | Y-coordinate. |