News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Text problem

Started by theheadmoose, April 06, 2008, 11:52:01 AM

Previous topic - Next topic

theheadmoose

Is it possible to do the following WITHOUT the text merging

text 0,0,"Hello"
text 0,0,"Goodbye"

All I get is merged text. I was hoping to have just "Goodbye" showing.
I would like to avoid using the CLS command option if possible.

Any help would be appreciated.

Thank you

PlayBasic V1.63M
IDE  1.1.5f

reno

Print "Hello"
Print "Goodbye"

Sync
WaitKey

:X
More games ? Go to my website :)
http://www.thereeteam.com/

theheadmoose

Thank you for your quick reply. I am sorry but I wasn't clear enough in the original question. I was hoping that the second text would OVERWRITE the first text at the same place on the screen with no merging.

nrasool


text 0,0,"Hello"
waitkey
test 0,0,"        "
waitkey
text 0,0,"Goodbye"


I haven't see any programming language which will do what you want, I could be wrong, but it will always overwrite if you don't clear the screen first. That what clearscreen is for, and that what you want, you want the 1st text at a certain point in the screen, then you want that cleared, and another text in its place. But that code I wrote does what you want

theheadmoose

Thanks for replying. I'll have to throw in the towel and go down the CLS route.

Thank you for your help

kevin

QuoteIs it possible to do the following WITHOUT the text merging
text 0,0,"Hello"
text 0,0,"Goodbye"

  yes, see bellow.

QuoteAll I get is merged text. I was hoping to have just "Goodbye" showing.

  This will only work when the new text is the same size or larger than the original..

  So if you draw  Goodbye then Hello,  some chr's won't be overwritten.

QuoteI would like to avoid using the CLS command option if possible.

Why ?



Colour=rgb(100,0,0)

OText(10,10,"Hello",Colour)
OText(10,10,"Goodbye",Colour)

Sync
Waitkey



Function Otext(Xpos,Ypos,S$,Colour)
x2=xpos+GetTextWidth(S$)
y2=ypos+GetTextHeight(S$)
boxc xpos,ypos,x2,y2,true,colour
Text Xpos,ypos,s$
EndFunction

theheadmoose

Brillant ! Thank you Kevin. It works and the world is wonderful.

As to why! I guess I'm still thinking old school where double buffering wasn't how things were done. I will have to change.

Thank you for your solution.

Regards
The Head Moose