Sprite Question - Spriting over a JPG #865
-
Thanks for a great suite of libraries Bodmer - I have used them in many of my projects with really cool results. Much appreciated! I have a question regarding the Sprite function. Can the background be a bitmap/jpg, and the sprite a small icon that can move about the image? I am tinkering with a sailing GPS tool that can help optimize tacking and jibing during a race, and wanted to plot a small boat icon (10x20pixels) over a JPG map (320x480pixels) and in this example, the map is a jpg of Lake Lehman in Switzerland and the surrounding ports/harbor/towns. Ideally i would like to be able to move the boat icon "over the top" of the JPG map. As a second option I would like to keep the route sailed as separate sprite and be able to overlay (or remove) this from the jpg map when selected/deselected. Naturally the JPG map is large and thus I don't want to redraw this image. The solution I have at the moment is the map of the area is in SPIFFS and I am pre-drawing the boat icon with the same blue of the lake - but of course this doesn't work when the boat is near the shore/harbor or anything else that's not the same color blue that I am pre-drawing with. Are the Sprite functions capable of doing what I am trying to describe? If so could you please point me in the direction of how best to tackle this? Any advice would be greatly appreciate. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Yes, you can do what you wish. You do not say which processor, screen and interface you are using... this is important since this will determine the approach. The minimal memory approach for the more RAM limited processors is to use the method for the Animated_dial viz:
You get some flicker with that approach but the annoyance level drops if the boat is not updated often. A more RAM intensive approach us used in the discussion and example I posted here. If the boat icon is not drawn very frequently (<10 times a second) then you could:
For the breadcrumb trail I would keep an array of x.y values (or lat, long) values. These could be plotted to screen and the sprite after step 4 |
Beta Was this translation helpful? Give feedback.
-
OK, this sketch deomonstrates the principles of option 2 but obviously this is just demo code that needs adapting! |
Beta Was this translation helpful? Give feedback.
-
Awesome!! Thank you so much for your time and guidance. It really is appreciated. Happy Holidays! |
Beta Was this translation helpful? Give feedback.
OK, this sketch deomonstrates the principles of option 2 but obviously this is just demo code that needs adapting!
Jpeg_Sprite_to_sprite_865.zip