Freeing Fonts

Fonts take up room in memory while they are loaded and therefore could potentially slow down your game. For this reason you should remove your fonts from memory using the FreeFont command after they have been applied. FreeFont works the same way that SetFont does in that you simply name the font that you want to free. You can free the fonts outside of the main loop of the program. Using the example from the previous section, free the fonts by adding the following code in bold:

While Not KeyDown( 1 )
RenderWorld
SetFont fntArial
Text 300,20, "This is Arial 24", True
SetFont fntArialB
Text 300,120, "This is Arial 24 Bold", True
SetFont fntArialI
Text 300,220, "This is Arial 24 Italics",True
SetFont fntArialU
Text 300,320, "This is Arial 24 Underlined", True
SetFont fntArialBIU
Text 300,420, "This is Arial 24 Bold, Italics and Underlined", True
Flip
Wend
FreeFont fntArial
						FreeFont fntArialB
						FreeFont fntArialI
						FreeFont fntArialU
						FreeFont fntArialBIU
End

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.2.87