libmsx
C library for MSX
Loading...
Searching...
No Matches
Meta-sprite interface.

Meta-sprite interface. More...

+ Collaboration diagram for Meta-sprite interface.:

Data Structures

struct  vec2i
 
struct  metasprite
 Meta-sprite ; an aggregate of sprites. More...
 

Typedefs

typedef struct vec2i vec2i_t
 
typedef struct metasprite metasprite_t
 Meta-sprite ; an aggregate of sprites.
 

Functions

void vmem_set_metasprite_s (vmemptr_t base, uint8_t plane, int x, int y, const metasprite_t *ms, const tagged_color_t tagged_color)
 MSX Display / Move single colored metasprite.
 
void vmem_set_metasprite_m (vmemptr_t base, uint8_t plane, int x, int y, const metasprite_t *ms, const tagged_color_t *tagged_colors)
 MSX Display / Move multi colored metasprite.
 
void vmem_set_metasprite_a (vmemptr_t base, uint8_t plane, int x, int y, const metasprite_t *ms)
 MSX Display / Move metasprite.
 

Detailed Description

Meta-sprite interface.


Data Structure Documentation

◆ vec2i

struct vec2i

Definition at line 35 of file metasprite.h.

Data Fields
int x
int y

◆ metasprite

struct metasprite

Meta-sprite ; an aggregate of sprites.

A meta-sprite is an aggregate of sprites, that could be layered, tiled, layered tiled sprites, or various layout of sprites.

A struct metasprite defines:

  • the layouts of sprites, of that the meta-sprite consists.
  • the sprite pattern numbers of sprites, of that the meta-sprite consists.
  • the anchor point of the meta-sprite, in the meta-sprite local coordinate system.

The below is not a member of the struct metasprite:

  • the position in the screen coordinate system
  • the sprite plane numbers of sprites
  • bitmap pattern of sprites
  • colors of sprites
  • tags (EC / CC / IC bit)

Definition at line 60 of file metasprite.h.

+ Collaboration diagram for metasprite:
Data Fields
uint8_t n Number of sprites, of that the metasprite consists.
vec2i_t anchor the anchor point of the metasprite, in the metasprite local coordinate system.
vec2i_t * layouts n element array of sprite positions, in the metasprite local coordinate system.
uint8_t * pats n element array of the sprite pattern numbers.

Typedef Documentation

◆ vec2i_t

typedef struct vec2i vec2i_t

◆ metasprite_t

typedef struct metasprite metasprite_t

Meta-sprite ; an aggregate of sprites.

A meta-sprite is an aggregate of sprites, that could be layered, tiled, layered tiled sprites, or various layout of sprites.

A struct metasprite defines:

  • the layouts of sprites, of that the meta-sprite consists.
  • the sprite pattern numbers of sprites, of that the meta-sprite consists.
  • the anchor point of the meta-sprite, in the meta-sprite local coordinate system.

The below is not a member of the struct metasprite:

  • the position in the screen coordinate system
  • the sprite plane numbers of sprites
  • bitmap pattern of sprites
  • colors of sprites
  • tags (EC / CC / IC bit)

Function Documentation

◆ vmem_set_metasprite_s()

void vmem_set_metasprite_s ( vmemptr_t  base,
uint8_t  plane,
int  x,
int  y,
const metasprite_t ms,
const tagged_color_t  tagged_color 
)

MSX Display / Move single colored metasprite.

Parameters
baseBase address of the sprite attribute table in VRAM.
planeThe plane number on which the 1st sprite of the metasprite is displayed.
xThe x-coordinate in the screen coordinate system.
yThe y-coordinate in the screen coordinate system.
msPointer to the metasprite structure.
tagged_colorA color code and sprite attribute tags, that is applied for all sprites in the metasprite.

◆ vmem_set_metasprite_m()

void vmem_set_metasprite_m ( vmemptr_t  base,
uint8_t  plane,
int  x,
int  y,
const metasprite_t ms,
const tagged_color_t tagged_colors 
)

MSX Display / Move multi colored metasprite.

Parameters
baseBase address of the sprite attribute table in VRAM.
planeThe plane number on which the 1st sprite of the metasprite is displayed.
xThe x-coordinate in the screen coordinate system.
yThe y-coordinate in the screen coordinate system.
msPointer to the metasprite structure.
tagged_colorsArray of color code and sprite attribute tags, that is applied for each sprite in the metasprite, one by one.

◆ vmem_set_metasprite_a()

void vmem_set_metasprite_a ( vmemptr_t  base,
uint8_t  plane,
int  x,
int  y,
const metasprite_t ms 
)

MSX Display / Move metasprite.

Note
This function does not change the sprite's color, tag bits, or the contents of the sprite color table. It only updates the x, y, and sprite pattern number in the sprite attribute table.
  • Pros: Works a little faster in sprite mode 2.
  • Cons: The EC (Early Clock) bit is not set correctly.

This function is supposed to be used together with vmem_set_sprite_color() in sprite mode 2.

In sprite mode 1 (MSX1 compatible sprite mode), you may want to use vmem_set_metasprite_s() or vmem_set_metasprite_m(). These are fast enough and convenient.

In sprite mode 2, vmem_set_metasprite_s() and vmem_set_metasprite_m() are also useful. However, they are a bit slower because they need to copy the color and tag bits to the color table element of each sprite.

The function vmem_set_metasprite_a() does not set the EC bit. If there is a sprite whose x-coordinate would to be less than 0 on the screen, that sprite is hidden (unshown) simply, instead of setting the EC bit.

Parameters
baseBase address of the sprite attribute table in VRAM.
planeThe plane number on which the 1st sprite of the metasprite is displayed.
xThe x-coordinate in the screen coordinate system.
yThe y-coordinate in the screen coordinate system.
msPointer to the metasprite structure.