SSD1306 OLED display driver  1.8.2
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SpritePool Class Reference

#include <sprite_pool.h>

Public Member Functions

 SpritePool ()
 
void drawSprites ()
 
void refreshScreen ()
 
uint8_t add (SPRITE &sprite)
 
void clear ()
 
void remove (SPRITE &sprite)
 
void setRect (SSD1306_RECT rect)
 

Static Public Attributes

static const uint8_t SP_ERR_NO_SPACE = 0xFF
 No free space for new sprite error.
 
static const uint8_t MAX_SPRITES = 10
 Defines max sprites number supported by SpritePool.
 

Protected Member Functions

virtual void drawBlock (uint8_t blockColumn, uint8_t blockRow)
 

Protected Attributes

NanoCanvas m_canvas
 Canvas used to draw sprites to avoid flickering.
 
SSD1306_RECT m_rect
 Rectangle, which specifies part of the display, used by the sprites.
 

Detailed Description

Sprites pool class automates processing of several sprites. It remembers pointers to SPRITE objects, and carefully updates only the areas, touched by the sprites. So, it reduces number of i2c calls to SSD1306 display.

Warning
this class is deprecated and not supported anymore.
Deprecated:
use NanoEngine, NanoSprite objects.

Definition at line 42 of file sprite_pool.h.

Constructor & Destructor Documentation

◆ SpritePool()

SpritePool::SpritePool ( )

Creates empty SpritePool object. It is able to hold up to 10 sprites on AVR platforms and up to 32 sprites on ESP platforms.

Member Function Documentation

◆ add()

uint8_t SpritePool::add ( SPRITE sprite)

Adds SPRITE object to the internal list of SpritePool

Parameters
sprite- reference to SPRITE object
Returns
index of added object or SP_ERR_NO_SPACE in case of error.

◆ clear()

void SpritePool::clear ( )

Removes all SPRITE objects from internal list of SpritePool.

◆ drawBlock()

virtual void SpritePool::drawBlock ( uint8_t  blockColumn,
uint8_t  blockRow 
)
protectedvirtual

This method is call every time 8x8 pixels block is needed to be drawn. Use m_canvas field variable, which represents block to update. For example, you can draw any 8x8 image, starting at 0,0 position in m_canvas.

Parameters
blockColumn- column of the block to redraw
blockRow- row of the block to redraw
Note
128x64 display has 16 columns and 8 rows.

◆ drawSprites()

void SpritePool::drawSprites ( )

Draw all areas, touched by the sprites. To remove flickering, the method uses NanoCanvas capabilities.

◆ refreshScreen()

void SpritePool::refreshScreen ( )

Redraws whole area, used by the sprites.

◆ remove()

void SpritePool::remove ( SPRITE sprite)

Removes specific SPRITE object from the SpritePool.

◆ setRect()

void SpritePool::setRect ( SSD1306_RECT  rect)
inline

Sets active paint area region in blocks (pixels / 8)

Parameters
rect- region in blocks (pixels / 8)

Definition at line 96 of file sprite_pool.h.


The documentation for this class was generated from the following file: