|
TinyGPU
|
#include <SpriteDisplay.h>
Public Member Functions | |
| SpriteDisplay (size_t width, size_t height, DisplayDriver< RGB_T > &driver, RGB_T backgroundColor=RGB_T(0)) | |
| SpriteDisplay (LCDBoard &board, RGB_T backgroundColor=RGB_T(0)) | |
| SpriteInfo< RGB_T, Surface< RGB_T > > & | addSprite (size_t x, size_t y, const ISurface< RGB_T > &sprite) |
| Adds a sprite to the framebuffer and draws it at the given position. | |
| bool | begin () |
| void | end () |
| Ends the processing. | |
| SpriteInfo< RGB_T, Surface< RGB_T > > & | addSprite (size_t x, size_t y, size_t maxX, size_t maxY, RGB_T backgroundColor) |
| Adds a sprite with a preallocated max buffer size for transformations. | |
| SpriteInfo< RGB_T, Surface< RGB_T > > & | addSprite (size_t x, size_t y, size_t maxX, size_t maxY, const ISurface< RGB_T > &sprite) |
| Adds a sprite with a preallocated max buffer size for transformations. | |
| void | removeSprite (SpriteInfo< RGB_T, Surface< RGB_T > > &sprite) |
| Removes a sprite and restores the pixels behind it. | |
| SpriteInfo< RGB_T, Surface< RGB_T > > * | getSprite (size_t x, size_t y) |
| Returns a reference to the sprite at the given position, if any. | |
| size_t | getSpriteCount () const |
| Returns the number of sprites currently managed by the framebuffer. | |
| SpriteInfo< RGB_T, Surface< RGB_T > > * | getSprite (int idx) |
| Returns a reference to the sprite at the given index, if valid. | |
| SpriteInfo< RGB_T, Surface< RGB_T > > * | getSprite (const ISurface< RGB_T > &sprite) |
| void | moveSprite (SpriteInfo< RGB_T, Surface< RGB_T > > &sprite, size_t newX, size_t newY) |
| Moves a sprite to a new position and redraws it. | |
| void | scaleSprite (SpriteInfo< RGB_T, Surface< RGB_T > > &sprite, float scale) |
| void | rotateSprite (SpriteInfo< RGB_T, Surface< RGB_T > > &sprite, float angleDegrees) |
| void | clear () |
| Clears the display and resets the background color. | |
| void | refresh () |
| void | setTouchDriver (TouchDriver &touch) |
| Defines the touch driver. | |
| void | processTouch () |
| Processes touch input and dispatches events to sprites if touched. | |
| void | fillScreen (RGB_T color) |
| Fills/clears the entire display with the specified color. | |
| void | setClearOnSpriteMove (bool clear) |
| Activates/deactivates the automatic clearing when we move a sprite. | |
| bool | isClearOnSpriteMove () const |
| Returns whether the automatic clearing is active when we move a sprite. | |
Protected Member Functions | |
| void | applyTransformedSprite (SpriteInfo< RGB_T, Surface< RGB_T > > &spriteInfo, Surface< RGB_T > &&transformedSprite) |
| Applies a transformed sprite image to the display and updates bookkeeping. | |
| void | clearSprite (size_t x, size_t y, const ISurface< RGB_T > &sprite) |
| void | clearSprite (Rect rect) |
| void | clearSprite (size_t x, size_t y, size_t width, size_t height) |
| void | displaySprite (size_t x, size_t y, const ISurface< RGB_T > &sprite) |
| Draws a sprite at (x, y) | |
Static Protected Member Functions | |
| static size_t | centeredCoordinate (size_t pos, size_t oldDim, size_t newDim) |
| Helper to calculate centered coordinate when scaling/rotating. | |
Protected Attributes | |
| DisplayDriver< RGB_T > & | driver_ |
| TouchDriver * | p_touchDriver = nullptr |
| LCDBoard * | p_board_ = nullptr |
| Sprite< RGB_T > | actual_sprite_background_ |
| size_t | width_ |
| size_t | height_ |
| RGB_T | backgroundColor_ |
| Vector< std::unique_ptr< SpriteInfo< RGB_T, Surface< RGB_T > > > > | sprites_ |
| Font5x7< RGB_T > | defaultFont_ |
| bool | is_clear_on_sprite_move = true |
|
inline |
|
inlineexplicit |
Constructs from an LCDBoard (see LCDBoards.h): takes its display driver and dimensions, and auto-attaches its touch controller if one is present. Only valid for RGB_T = RGB565, since every LCDBoard's display() is RGB565.
begin() on the resulting SpriteDisplay calls LCDBoard::begin() (backlight + SPI/QSPI bus + display controller + touch controller) instead of just the display driver's begin() - do not also call board.begin() yourself, or the display controller's init sequence (and, on boards that need it, the display-inversion fix) runs twice.
|
inline |
Adds a sprite to the framebuffer and draws it at the given position.
|
inline |
Adds a sprite with a preallocated max buffer size for transformations.
|
inline |
Adds a sprite with a preallocated max buffer size for transformations.
|
inlineprotected |
Applies a transformed sprite image to the display and updates bookkeeping.
|
inline |
Starts the processing. If constructed from an LCDBoard, this brings up the whole board (LCDBoard::begin()); otherwise just the display driver (driver_.begin()).
|
inlinestaticprotected |
Helper to calculate centered coordinate when scaling/rotating.
|
inline |
Clears the display and resets the background color.
|
inlineprotected |
|
inlineprotected |
Clears the background of the indicated sprite at (x, y) with the background color.
|
inlineprotected |
|
inlineprotected |
Draws a sprite at (x, y)
|
inline |
Ends the processing.
|
inline |
Fills/clears the entire display with the specified color.
|
inline |
Returns a reference to the SpriteInfo for the indicated surface, if it exists.
|
inline |
Returns a reference to the sprite at the given index, if valid.
|
inline |
Returns a reference to the sprite at the given position, if any.
|
inline |
Returns the number of sprites currently managed by the framebuffer.
|
inline |
Returns whether the automatic clearing is active when we move a sprite.
|
inline |
Moves a sprite to a new position and redraws it.
|
inline |
Processes touch input and dispatches events to sprites if touched.
|
inline |
Refreshes the display and redraws all sprites in their current positions and states.
|
inline |
Removes a sprite and restores the pixels behind it.
|
inline |
Rotates a sprite image and redraws it at its current position. Always re-renders from the pristine original at (currentScale, angleDegrees)
|
inline |
Scales a sprite image and redraws it at its current position. Always re-renders from the pristine original at (scale, currentAngleDegrees)
|
inline |
Activates/deactivates the automatic clearing when we move a sprite.
|
inline |
Defines the touch driver.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |