Arduboy2 Library  6.0.0
SpritesB Class Reference

A class for drawing animated sprites from image and mask bitmaps. Optimized for small code size. More...

#include <SpritesB.h>

Static Public Member Functions

static void drawExternalMask (int16_t x, int16_t y, const uint8_t *bitmap, const uint8_t *mask, uint8_t frame, uint8_t mask_frame)
 Draw a sprite using a separate image and mask array. More...
 
static void drawPlusMask (int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
 Draw a sprite using an array containing both image and mask values. More...
 
static void drawOverwrite (int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
 Draw a sprite by replacing the existing content completely. More...
 
static void drawErase (int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
 "Erase" a sprite. More...
 
static void drawSelfMasked (int16_t x, int16_t y, const uint8_t *bitmap, uint8_t frame)
 Draw a sprite using only the bits set to 1. More...
 

Detailed Description

A class for drawing animated sprites from image and mask bitmaps. Optimized for small code size.

The functions in this class are identical to the Sprites class. The only difference is that the functions in this class are optimized for smaller code size rather than execution speed.

See the Sprites class documentation for details on the use of the functions in this class.

Even if the speed is acceptable when using SpritesB, you should still try using Sprites. In some cases Sprites will produce less code than SpritesB, notably when only one of the functions is used.

You can easily switch between using the Sprites class or the SpritesB class by using one or the other to create an object instance:

Sprites sprites; // Use this to optimize for execution speed
SpritesB sprites; // Use this to (likely) optimize for code size
See also
Sprites

Definition at line 40 of file SpritesB.h.

Member Function Documentation

◆ drawErase()

void SpritesB::drawErase ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
uint8_t  frame 
)
static

"Erase" a sprite.

Parameters
x,yThe coordinates of the top left pixel location.
bitmapA pointer to the array containing the image frames.
frameThe frame number of the image to erase.
See also
Sprites::drawErase()

Definition at line 21 of file SpritesB.cpp.

◆ drawExternalMask()

void SpritesB::drawExternalMask ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
const uint8_t *  mask,
uint8_t  frame,
uint8_t  mask_frame 
)
static

Draw a sprite using a separate image and mask array.

Parameters
x,yThe coordinates of the top left pixel location.
bitmapA pointer to the array containing the image frames.
maskA pointer to the array containing the mask frames.
frameThe frame number of the image to draw.
mask_frameThe frame number for the mask to use (can be different from the image frame number).
See also
Sprites::drawExternalMask()

Definition at line 10 of file SpritesB.cpp.

◆ drawOverwrite()

void SpritesB::drawOverwrite ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
uint8_t  frame 
)
static

Draw a sprite by replacing the existing content completely.

Parameters
x,yThe coordinates of the top left pixel location.
bitmapA pointer to the array containing the image frames.
frameThe frame number of the image to draw.
See also
Sprites::drawOverwrite()

Definition at line 16 of file SpritesB.cpp.

◆ drawPlusMask()

void SpritesB::drawPlusMask ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
uint8_t  frame 
)
static

Draw a sprite using an array containing both image and mask values.

Parameters
x,yThe coordinates of the top left pixel location.
bitmapA pointer to the array containing the image/mask frames.
frameThe frame number of the image to draw.
See also
Sprites::drawPlusMask()

Definition at line 31 of file SpritesB.cpp.

◆ drawSelfMasked()

void SpritesB::drawSelfMasked ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
uint8_t  frame 
)
static

Draw a sprite using only the bits set to 1.

Parameters
x,yThe coordinates of the top left pixel location.
bitmapA pointer to the array containing the image frames.
frameThe frame number of the image to draw.
See also
Sprites::drawSelfMasked()

Definition at line 26 of file SpritesB.cpp.


The documentation for this class was generated from the following files:
Sprites
A class for drawing animated sprites from image and mask bitmaps.
Definition: Sprites.h:76
SpritesB
A class for drawing animated sprites from image and mask bitmaps. Optimized for small code size.
Definition: SpritesB.h:41