DrawText Background
BlitzMax Forums/BlitzMax Beginners Area/DrawText Background
| ||
Hi, with SetColor i can set the *foreground* color of a text i draw with DrawText. How to test its *background* color? Thanks |
| ||
DrawRect before drawing the text. Text is drawn with alphablending so it can't have both a background and a foreground. |
| ||
Like ImaginaryHuman said, there is no background color, so you'll need to manually blot it out with a drawrect or similar. You can use the TextWidth and TextHeight commands to find out the dimensions of the text in pixels, so you can figure out where to draw the background rectangle. |
| ||
But also note that TextWidth/Height functions are quite expensive. You may want to cache the results, if you can. |
| ||
Oh, one more thing: TextHeight and TextWidth do NOT pay attention to any alternate scales that may be defined with SetScale, so if you do draw your images at a different scale, make sure to multiply the results by the same scale to get the accurate size at it would appear on the screen. |