O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required