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 | Public Attributes | List of all members
SPRITE Struct Reference

#include <nano_gfx_types.h>

Public Member Functions

void setPos (uint8_t x, uint8_t y)
 
void draw ()
 
void eraseTrace ()
 
void erase ()
 
bool isNearMove () const
 
SSD1306_RECT getRect () const
 
SSD1306_RECT getLRect () const
 
SSD1306_RECT getUpdateRect () const
 

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.
 
const uint8_t * transparentMask
 Pointer to PROGMEM data, representing sprite transparencyMask (can be nullptr)
 

Detailed Description

SPRITE structure represents logical graphics object

Deprecated:
Use NanoSprite or NanoFixedSprite instead.

Definition at line 146 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.

◆ erase()

void SPRITE::erase ( )

Clears sprite from the display leaving black rectangle.

◆ eraseTrace()

void SPRITE::eraseTrace ( )

Clears some sprite parts in old position on the display.

◆ 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 222 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 206 of file nano_gfx_types.h.

◆ getUpdateRect()

SSD1306_RECT SPRITE::getUpdateRect ( ) const
inline

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).

Definition at line 239 of file nano_gfx_types.h.

◆ isNearMove()

bool SPRITE::isNearMove ( ) const
inline

Returns true if sprite is moved not far from previous position, and old and new rects have intersection.

Definition at line 191 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: