Stop sprite from scrolling off screen #2971
-
I have a 240 x 240 pixel round display and I'm trying to scroll a 480 x 240 sprite from -240 (off the display) to 0, essentially just taking what's seen on the right half of the sprite and scrolling to see what's on the left half of the sprite. I got it to scroll but it just keeps scrolling past the edge of the sprite. Slide.h is just the byte array for the image I'm pushing into the sprite. Another thing is that I'd like to have it do this once during the code like an initialization screen. I'm at a loss... #include <TFT_eSPI.h> TFT_eSPI tft = TFT_eSPI(); TFT_eSprite slide = TFT_eSprite(&tft); void setup() { tft.setRotation(0); slide.setSwapBytes(true); void loop() { void createSlide(){ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
loop() will keep cycling around so you need to set a limit on the number of times the sprite is scrolled and drawn. Try this:
|
Beta Was this translation helpful? Give feedback.
loop() will keep cycling around so you need to set a limit on the number of times the sprite is scrolled and drawn. Try this: