3D Game Builder SDK

SDK Functions

gameCloseFont( int id )


Close a font that was created using the gameCreateFont( int id, char * name, int height ) function.

There is a default system font (font 0). You cannot modify or close the default font 0.


void gameCloseFont( int id )

int id

= the font id number to close (range = 1 to 10)

return value

= void (nothing)


You create a new font using the gameCreateFont( int id, char * name, int height ) function. Then you can select the new font using the gameSelectFont( int id ) function before you start drawing.

You do not have to create a new font to use this function because there is a default system font (font 0) which will be used to draw the text string. To select the default font 0 use:


You can set the font position on screen using the gameSetFontPosition( float x, float y, float z ) function. The screen coordinates are in pixels. The screen size = 480 x 272. The center of the screen = ( 0,0,0 ) the top left = ( -240,-136,0 ) and the bottom right = ( 240, 136, 0 ). Set the z value as the depth of the font on screen. Typically use the range from 0.0 (top of screen) to 1.0 (bottom of screen). This allows you to draw text on top and behind other text (for example, to create a black shadow).

Set the font color and transparency using the gameSetFontColor( float r, float g, float b, float a ) function. These values are in the range 0.0 (no color) to 1.0 (full color) for each of RED, GREEN and BLUE. The ALPHA is the transparency value in the range 0.0 (fully transparent / invisible) to 1.0 (no tranparency / opaque).

When you are finished with the font (usually at the end of your game) you can close it using the gameCloseFont( int id ) function.

For Example

#include "3dgamebuilder.h"

// exported game function
DLL_EXPORT int gameLoop(void)
	// create a new font
	gameCreateFont( 1, "Arial", 20 );

	// game loop
		// read the controller

		// start drawing

		// draw hello world in the middle of the screen
		gameSetFontColor( 1.0f, 1.0f, 0.0f, 1.0f );
		gameSetFontPosition( -100.0f, 0.0f, 0.0f );
		gameDrawFont( "Hello World!" );

		// end of drawing

	// clean up

	return 0;

See Also

  gameCreateFont( int id, char * name, int height )
  gameDrawFont( char * message )
  gameSetFontPosition( float x, float y, float z )
  gameSetFontColor( float r, float g, float b, float a )
  gameSelectFont( int id )
  gameCloseFont( int id )

Go Back

SDK Functions