LCDGFX LCD display driver  1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
SPRITE Struct Reference

SPRITE structure represents logical graphics object. More...

#include <nano_gfx_types.h>

Public Member Functions

void setPos (uint8_t x, uint8_t y)
 Updates active position of the sprite (doesn't redraw it) More...
 
void draw ()
 Draws sprite on the display. More...
 
void eraseTrace ()
 Clears some sprite parts in old position on the display.
 
void erase ()
 Clears sprite from the display leaving black rectangle.
 
bool isNearMove () const
 Returns true if sprite is moved not far from previous position, and old and new rects have intersection.
 
SSD1306_RECT getRect () const
 Returns area in 8-pixel blocks, which is used by the sprite. More...
 
SSD1306_RECT getLRect () const
 Returns area in 8-pixel blocks, which was used by the sprite last time For example, if sprite pixels coordinates are 10,18 and size is 8x8, the rect will be (left:1,top:2,right:2,bottom:3). More...
 
SSD1306_RECT getUpdateRect () const
 Returns area in 8-pixel blocks, which includes old and new position For example, if sprite pixels coordinates are 12,18 and size is 8x8, and sprite is moved to the right by 6 pixels, the rect will be (left:1,top:2,right:3,bottom:3).
 

Public Attributes

uint8_t x
 draw position X on the screen
 
uint8_t y
 draw position Y on the screen
 
uint8_t w
 sprite width
 
uint8_t lx
 last draw position X on the screen
 
uint8_t ly
 last draw position Y on the screen
 
const uint8_t * data
 Pointer to PROGMEM data, representing sprite image.
 

Detailed Description

SPRITE structure represents logical graphics object.

Deprecated:
Use NanoSprite or NanoFixedSprite instead.

Definition at line 63 of file nano_gfx_types.h.

Member Function Documentation

◆ draw()

void SPRITE::draw ( )

Draws sprite on the display.

Position can be changed by updating x and y fields of SPRITE structure.

◆ getLRect()

SSD1306_RECT SPRITE::getLRect ( ) const
inline

Returns area in 8-pixel blocks, which was used by the sprite last time For example, if sprite pixels coordinates are 10,18 and size is 8x8, the rect will be (left:1,top:2,right:2,bottom:3).

if sprite pixels coordinates are 32,16 and size is 8x8, the rect will be (left:4,top:2,right:4,bottom:2).

Definition at line 139 of file nano_gfx_types.h.

◆ getRect()

SSD1306_RECT SPRITE::getRect ( ) const
inline

Returns area in 8-pixel blocks, which is used by the sprite.

For example, if sprite pixels coordinates are 10,18 and size is 8x8, the rect will be (left:1,top:2,right:2,bottom:3). if sprite pixels coordinates are 32,16 and size is 8x8, the rect will be (left:4,top:2,right:4,bottom:2).

Definition at line 121 of file nano_gfx_types.h.

◆ setPos()

void SPRITE::setPos ( uint8_t  x,
uint8_t  y 
)

Updates active position of the sprite (doesn't redraw it)

Parameters
x- horizontal position
y- vertical position

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