FabGL
ESP32 Display Controller and Graphics Library

◆ setSprites()

void setSprites ( T *  sprites,
int  count 
)
inlineinherited

Sets the list of active sprites.

A sprite is an image that keeps background unchanged.
There is no limit to the number of active sprites, but flickering and slow refresh happens when a lot of sprites (or large sprites) are visible.
To empty the list of active sprites call BitmappedDisplayController.removeSprites().

Parameters
spritesThe list of sprites to make currently active.
countNumber of sprites in the list.

Example:

// define a sprite with user data (velX and velY)
struct MySprite : Sprite {
  int  velX;
  int  velY;
};

static MySprite sprites[10];

VGAController.setSprites(sprites, 10);
Examples:
SSD1306_OLED/128x32/CollisionDetection/CollisionDetection.ino, SSD1306_OLED/128x64/CollisionDetection/CollisionDetection.ino, ST7789_TFT/240x240/Sprites/Sprites.ino, VGA/CollisionDetection/CollisionDetection.ino, VGA/SpaceInvaders/SpaceInvaders.ino, and VGA/Sprites/Sprites.ino.

Definition at line 835 of file displaycontroller.h.