Display changing numbers or strings on a background image #1886
-
I love this library! I'm attempting to display numbers and text on an image. By not passing a background color argument, I'm able to display static numbers and strings just fine, but I'm unable to figure out a way to display changing values of numbers. I'm sure there is a way to accompolish this (maybe with sprites?). Can anyone provide some pointers or the correct example to look into? I see that this discussion recomments using padding, but it still assumes that a background color is provided. I wish to accompolish this with a transparent background. [edit] Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It is possible using sprites but is a rather complicated process. Essentially you create 2 sprites, sprite 1 has a copy of the background area the text occupies, sprite 2 is the same size. |
Beta Was this translation helpful? Give feedback.
It is possible using sprites but is a rather complicated process. Essentially you create 2 sprites, sprite 1 has a copy of the background area the text occupies, sprite 2 is the same size.
The background is drawn in sprite 1 with the necessary offsets to capture the correct area. When the number is to be drawn, sprite 1 is copied to sprite 2 and the number drawn in sprite 2, sprite 2 is then copied to the screen with the correct offsets.