Hello,
trying to display varying portions of a sprite, moved via touch screen gestures, drives me crazy.
Swiping with the finger up and then down makes the text disappear, once is has been pushed beyond the screen edge. Instead, swiping down and then up again does also show that portion of text, which has temporarily moved "out" of the screen. The latter behaviour is what I had expected.
Without success I tried to solve this with deploying the scrollRectangle() function, working with explicit background colors, with transparency...
I thought, once written to the sprite, the text stays there, irrespective of sprite movement.
Am I misunderstanding the concept of a sprite?
The following is the example sketch to program an M5Core2 with 320x240 touch screen:
#include <M5Core2.h>
TFT_eSprite asprite(&M5.Lcd);
Event& e = M5.Buttons.event;
void setup() {
M5.begin();
asprite.setColorDepth(8);
asprite.createSprite(320,500); // sprite height > 2xscreen height
asprite.setTextFont(2);
for (int i=0; i<30; i++) { asprite.printf("Line %d -- some string for testing\n",i+1 ); }
asprite.pushSprite(0,0);
}
void loop() {
M5.update();
if (e & (E_MOVE | E_RELEASE)) {
asprite.scroll(0,e.to.y-e.from.y);
asprite.pushSprite(0,0);
}
}
I would be grateful for any advice. Thanks and best,
didigs