Support for sprites? #243
Replies: 15 comments 52 replies
-
it should be something like canvas. But since I do not have experience on using sprites, the feature may not enough for actual use. Can you give me your requirements? |
Beta Was this translation helpful? Give feedback.
-
I can have a look at the canvas feature. For Sprites, the general idea is to have smooth overlay graphics that can be animated/moved without a complete refresh of the screen. At least that's the way I understand it. Here's a good example that helps describe it: https://www.youtube.com/watch?v=sRGXQg7028A |
Beta Was this translation helpful? Give feedback.
-
It should be the job of higher presentation layer library like LVGL. |
Beta Was this translation helpful? Give feedback.
-
I have written a simple sprite class which subclasses the canvas type (happy to share the code), but in order to implement transparency with any speed the canvas class needs to publicly expose its _framebuffer pointer. |
Beta Was this translation helpful? Give feedback.
-
Ok, exposed. Please get update to test your class. |
Beta Was this translation helpful? Give feedback.
-
Ok, a few evenings of work and I have a little tech demo working. This is built by subclassing the canvas class. Currently runs about 23FPS... which is quite impressive given the amount of data being shifted each frame! But I wonder if I can get it to run faster. https://youtu.be/r1OnUF03_B4[Smooth scrolling Tech Demo](https://youtu.be/r1OnUF03_B4) |
Beta Was this translation helpful? Give feedback.
-
You can replace with free assets before expose it to public. |
Beta Was this translation helpful? Give feedback.
-
An updated video, the Sprite library now supports palette based images to halve RAM usage (each image can have its own palette and expanded to 16bit upon drawing to the Canvas). The palette based Blitter copy is a bit exotic as 8bit RAM reads are very slow on the ESP32, so 4pixels are fetched as single 32bit read, then unpacked in CPU registers during the blit loop. |
Beta Was this translation helpful? Give feedback.
-
how you calculate FPS before? |
Beta Was this translation helpful? Give feedback.
-
Ok, I've been playing around with my sprite library, and have decided that subclassing from the canvas class probably isn't the best way to go. Instead, I will use composition, and have the sprite class allocate its own canvas internally as needed. The internal canvas object won't be private or protected so drawing operations can be exposed if needed. I'm implementing a more structured scene class to allow multiple sprites to be managed easily and cleanly. So this makes more sense, despite some. Serious API breakage, hopefully no one is actually using my class yet :-) |
Beta Was this translation helpful? Give feedback.
-
Apologies for the lack of updates. I have been working with @PlastiBots and we now have a working sprite library. Currently I consider the library in Beta. Please test with the Arduino_GFX library on as many different hardware configurations as possible, and post issues/bugs/feature requests on my Github. |
Beta Was this translation helpful? Give feedback.
-
Your code is already tuned speed very well, seems not too much can tune: |
Beta Was this translation helpful? Give feedback.
-
And this is the result with same screen but connect with SPI@80MHz: |
Beta Was this translation helpful? Give feedback.
-
The first implementation using GIF as a Sprite master source: |
Beta Was this translation helpful? Give feedback.
-
Hey guys.. Pulled together a video of my NeoLmn8 project using a T-RGB Arduino GFX and Matt's Sprite library. Shows off some cool use cases: https://youtu.be/B_X_v7OUKqw |
Beta Was this translation helpful? Give feedback.
-
Per the subject, does this library support sprites? Thx.
Beta Was this translation helpful? Give feedback.
All reactions