Why doesn't this do anything?

Blitz3D Forums/Blitz3D Beginners Area/Why doesn't this do anything?

Jake007(Posted 2004) [#1]
Copied this from the help manual (Using BlitzPlus) When I runt it, I just get a black sreen, no data????

; LoadFont/SetFont/FreeFont example

; enable graphics mode
Graphics 800,600,16

; Set global on font variables
Global fntArial,fntArialB,fntArialI,fntArialU

;Load fonts to a file handle variables
fntArial=LoadFont("Arial",24,False,False,False)
fntArialB=LoadFont("Arial",18,True,False,False)
fntArialI=LoadFont("Arial",32,False,True,False)
fntArialU=LoadFont("Arial",14,False,False,True)

; set the font and print text
SetFont fntArial
Text 400,0,"This is just plain Arial 24 point",True,False

SetFont fntArialB
Text 400,30,"This is bold Arial 18 point",True,False

SetFont fntArialI
Text 400,60,"This is italic Arial 32 point",True,False

SetFont fntArialU
Text 400,90,"This is underlined Arial 14 point",True,False

; Standard 'wait for ESC' from user
While Not KeyHit(1)
Wend

; Clear all the fonts from memory!
FreeFont fntArial
FreeFont fntArialB
FreeFont fntArialI
FreeFont fntArialU


jhocking(Posted 2004) [#2]
BlitzPlus may require drawing to the backbuffer and page flipping. This code is writing the text directly to the screen (ie. the front buffer.) I don't really know; I don't use BlitzPlus, just Blitz3D.


eBusiness(Posted 2004) [#3]
By the way, you don't need to unload everything, it will be done automatically when the program ends, dunno if you already know.


Tiger(Posted 2004) [#4]
Hello, try to insert a Flip command after last Text command.
The text you try to print is in the backbuffer so you need to swap it with the frontbuffer.

Bye.


Rogue Vector(Posted 2004) [#5]
Make sure the color of your text is not black.

I've done this a number of times.

Add the line:

Color 255, 0, 0

For Red text etc.

Regards,

Rogue Vector


Hansie(Posted 2004) [#6]
"unloading" things you have loaded is good programming practice, and Blitz should requires this by default. Everything else is bad programming. like opening windows and not testing if the mode is supported!


jhocking(Posted 2004) [#7]
"text you try to print is in the backbuffer"

Is this always true for BlitzPlus? This was what I wasn't sure of in my post. This certainly isn't the case for Blitz3D; while you definitely should be drawing to the backbuffer and doing page flipping, this isn't automatically the case. If you don't call SetBuffer then drawing commands will default to drawing to the frontbuffer (ie. directly to the screen.)

I only mean 2D drawing commands (which Text is.) The 3D drawing command, RenderWorld, always draws to the backbuffer I think.


sswift(Posted 2004) [#8]
Hansie:
Blitz is specifically designed to know what you have loaded, and how to unload it. It's built into the language. It will happen regardless of whether you do it or not. It is not sloppy programming when you know the language will do it for you.


Warren(Posted 2004) [#9]
I was going to say the same thing, but sswift beat me to it...

So, yeah, what he said.


Tiger(Posted 2004) [#10]
Jhocking:
It seems that Blitz+ works in a different way then Blitz3D.
Blitz+ sets to backbuffert even if you don't use SetBuffer Backbuffer() command. So you need to use flip.

bye.


Jake007(Posted 2004) [#11]
Thanks for the help. I copied this from the online help file to to some work with fonts, that is why I was confused as to why it didn't work since it came from Blitz.

Could this have possibly been written for BlitzBasic and not Blitz Plus?

Jake


jhocking(Posted 2004) [#12]
"Could this have possibly been written for BlitzBasic and not Blitz Plus?"

Undoubtedly.