libmsx
C library for MSX
Loading...
Searching...
No Matches
SM2 display Animated Color Sprites.

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.
 

Detailed Description

Display Animated Color Sprites.

Function Documentation

◆ sm2_flush()

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.

See also
sm2_add_sprite()
sm2_add_cel()

◆ sm2_add_sprite()

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.

Parameters
sSprite object.
xX-coordinate.
yY-coordinate.
See also
sm2_flush()
Note
To display or move sprites added to the internal buffer by sm2_add_sprite() or sm2_add_cel() on screen, sm2_flush() must be called.

◆ sm2_add_cel()

void sm2_add_cel ( const sm2_Cel * cel,
int x,
int y )

MSX2 Add a sprite cel to the internal buffer.

Parameters
celSprite cel.
xX-coordinate.
yY-coordinate.
See also
sm2_flush()
Note
To display or move sprites added to the internal buffer by sm2_add_sprite() or sm2_add_cel() on screen, sm2_flush() must be called.

◆ sm2_reserve()

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.

Parameters
nThe number of reserved sprite planes. (0 <= n <= 32)
See also
sm2_put_sprite()
sm2_put_cel()
sm2_get_reserved()

◆ sm2_get_reserved()

uint8_t sm2_get_reserved ( void )

MSX2 Returns the number of reserved sprite planes.

Returns
The number of reserved sprite planes.
See also
sm2_reserve()

◆ sm2_put_sprite()

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.

Parameters
base_planeThe 1st plane number.
sSprite object.
xX-coordinate.
yY-coordinate.
See also
sm2_reserve()

◆ sm2_put_cel()

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.

Parameters
base_planeThe 1st plane number.
celSprite cel.
xX-coordinate.
yY-coordinate.
See also
sm2_reserve()