Page 1 of 1

Blanking a section of screen in graphics mode

Posted: Sun Mar 15, 2015 9:39 pm
by Isteward
In Graphics mode I wish to have a lower section of the screen blanked so I can draw text on it.
For example:

graphics
graphics clear 1,1,1
draw color 0,0,0
draw text "first line" at 100,100
Now 'blank it
draw text " " at 100,100
' or overwrite it'
draw text "second line" at 100,100

If you run this you will see that it does not blank or overwrite the first draw text.

I just want to blank it out. How can I do this in Basic using graphics mode?

Thanks for any help you can give

Re: Blanking a section of screen in graphics mode

Posted: Mon Mar 16, 2015 2:28 am
by Mr. Kibernetik
In this example "to blank" you mean to overwrite with black color.
So you have to fill a rectangle with black color over old text.

For example if your background was red, you had to overwrite it with red color.

Re: Blanking a section of screen in graphics mode

Posted: Mon Mar 16, 2015 6:14 pm
by Operator
Try this...

Code: Select all


graphics 
graphics clear 1,1,1
str1$ = "first line"
str2$ = "second line"

draw color 0,0,0
draw text "first line" at 100,100

'now blank it
'draw text "  " at 100,100 will not work

'draw over text using a rect...
'get text width and height
tx = text_width(str1$)
ty = text_height(str1$)
'use same color as background
fill color 1,1,1
'animation...
for i = 1 to 10
  fill alpha i/10
  fill rect 100,100 to 100+tx, 100+ty
  pause 0.2
next i

'now draw second line over rect...
draw color 0,0,0
for i = 1 to 10
  draw alpha i/10
  draw text str2$ at 100,100
  pause 0.2
next i