-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
push a large sprite to a smaller window #712
Comments
I found in another issue the possibility to use the Sprite_Scroll_16Bit example as follows:
With this example i can scroll up and down in a smooth way inside the sprite. But as soon as i do it in my sketch the same way, it is very slow. :( |
Thanks for raising this. I think a sprite pushWindow function would be relatively easy to add. ie: spr.pushWindow(tx, ty, sx, sy, sw, sh); Where: There is already a function called setWindow that does all the bounds checks and can be used in this new function. The code for rendering a cropped sprite also exists so it is a case of bringing these together in a single function. What do you think? |
That sounds fantastic! |
I started to implement, but now i don't now further.
|
I think pushSprite is a better function name as it is a similar function to that existing:
You will need to add a new function prototype to TFT_eSPI.h
I will expand this function for other colour depths and may just create an overloaded version of pushSprite with extra optional parameters. |
I think a "wrap" feature would also be good to have in this function via an optional boolean, viz:
Creating a spinner menu, magnetic compass, or "fruit/slot machine" rotating wheel type display would then be easy. |
The wrap feature sounds really interesting, haven't thought about that possibility yet.
For now I have to thank you a lot for the support and all your work! |
Just wondering if there would be any value in having the following as optional parameters?
Tony |
The suggested code only works for special cases for 4bpp (x start and x end must always be even) and for 1bpp (x start and x end must be integer multiples of 8). This code should work without these constraints but has not been fully tested yet:
|
Hey! And here the sketch I used (click to expand)
|
My local library has now been updated with tested code, this will be released in the next 2 weeks. In the meantime the 16 bit code should provide the solution you need. |
Library updated, please raise any bugs in new issue. Thanks. |
Now it works perfectly! Thank you very much!!! |
Hey Bodmer,
Your lib is fantastic! I'm using it a lot, thank you very much!
Now I have a question and could not find a solution yet:
I have a sprite higher then my display and I can "scroll" the sprite up and down by pushing the sprite to different positions. Works really fine!
Now I want to have a small part on the bottom of my display where the sprite is not affecting the content (like a fixed footer). As far as I know there is no method to set a window where the sprite is pushed to. How could I solve my problem?
The %%% mark the part with which I have the difficulties. The ### are logically not affected by scrolling.
I already tried with the scroll-method, but as soon as I change the scroll direction i have to repaint the content which scrolled already out of the display. I tried a lot, but I did not get it to work (different scroll speed makes it really difficult to calculate the position where the content has to be written).
The text was updated successfully, but these errors were encountered: