Cannot increase Sprite image Window in Loop()

I am using a Bluepill (STM32F103C8) with 128k memory.

When I increase the Sprite image window there is nothing on the display.
So I start with a image of 64x64 and the increment the image window by 1 after every complete cycle, but the window stays the same size.

Why does the image size not get bigger when incremented in the Loop()?

#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite img = TFT_eSprite(&tft);
int ver = 64;
int hor = 64;
int x = 0;


void setup()
{
  tft.init();
  tft.setRotation(3);
  //img.createSprite(ver, hor);
}

void loop()
{
  img.createSprite(ver, hor);

  for (x = 0; x < 160; x++)
  {
    //tft.fillCircle(x, 36, 30, TFT_BLACK);
    img.fillCircle(x - 1, 36, 30, TFT_BLACK);

    //tft.fillCircle(x, 36, 30, TFT_RED);
    img.fillCircle(x, 36, 30, TFT_RED);
    img.pushSprite(0, 0);

  }

  tft.drawNumber(ver, 10, 80, 4);
  tft.drawNumber(hor, 80, 80, 4);
  ver ++;
  hor ++;
}

image

There is no lines or flickering on the red ball the lines in the photo is due to the ball moving while the photo was taken.

You forgot to delete the sprite

Thanks.
Huh? .. How?

Is there a "img.DeleteSprite(x,y,) function?

Yes, img.deleteSprite();

Make sure to restrict ver and hor to safe values

Maybe you want to play with setWindow or other sprite functions

1 Like

Yes thanks, I tried it before your reply and it works.

 tft.drawNumber(ver, 10, 80, 4);
  tft.drawNumber(hor, 80, 80, 4);
  ver ++;
  hor ++;
  img.deleteSprite();

Thanks.

Yes I can now see at what values the image stops to work, I will play around.