#682 Add created() function for sprites

New function added:
  bool created(void);
to check if sprite has been rotated. Example:

if ( !spr.created() ) Serial.println("Sprite has not been created");
This commit is contained in:
Bodmer 2020-07-07 00:52:55 +01:00
parent 8fc52dc1f5
commit a6d50ea5ef
8 changed files with 18 additions and 6 deletions

View File

@ -112,6 +112,16 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
}
/***************************************************************************************
** Function name: created
** Description: Returns true is sprite has been created
*************************************************************************************x*/
bool TFT_eSprite::created(void)
{
return _created;
}
/***************************************************************************************
** Function name: ~TFT_eSprite
** Description: Class destructor

View File

@ -22,6 +22,9 @@ class TFT_eSprite : public TFT_eSPI {
void* createSprite(int16_t width, int16_t height, uint8_t frames = 1);
// Returns true if sprite has been created
bool created(void);
// Delete the sprite to free up the RAM
void deleteSprite(void);

View File

@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.2.13"
#define TFT_ESPI_VERSION "2.2.14"
/***************************************************************************************
** Section 1: Load required header files

View File

@ -32,7 +32,7 @@ void setup() {
Serial.begin(115200);
randomSeed(analogRead(A0));
tft.init();
tft.setRotation(2);
tft.setRotation(0);
tft.fillScreen(ILI9341_BLACK);
setupScrollArea(TOP_FIXED_AREA, BOT_FIXED_AREA);
}

View File

@ -6,7 +6,7 @@
// parallel TFT's (tested with ILI9341 and ILI9481)
// The sketch will run on processors without DMA and also parallel
// interface TFT's. Comment out line 25 for no DMA.
// interface TFT's. Comment out line 29 for no DMA.
// Library here:
// https://github.com/Bodmer/TFT_eSPI

View File

@ -31,7 +31,6 @@
//====================================================================================
// Libraries
//====================================================================================
// Call up the SPIFFS FLASH filing system this is part of the ESP Core
#include <TFT_eSPI.h> // Hardware-specific library

View File

@ -1,6 +1,6 @@
{
"name": "TFT_eSPI",
"version": "2.2.13",
"version": "2.2.14",
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
"repository":

View File

@ -1,5 +1,5 @@
name=TFT_eSPI
version=2.2.13
version=2.2.14
author=Bodmer
maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32