Xors3d Engine
Text drawing

Functions

int xFontHeight ()
 Returns the height, in pixels, of the currently selected font.
int xFontWidth ()
 Returns the width, in pixels, of the currently selected font.
void xFreeFont (Font *font)
 Frees up a font.
Font * xLoadFont (const char *name, int height, bool bold=false, bool italic=false, bool underline=false, const char *fontface="")
 Loads a font and returns a font handle.
void xSetFont (Font *font)
 Activates a font previously loaded into memory (though the xLoadFont() command) for future use with printing commands such as xText().
int xStringHeight (const char *textString)
 Returns the size, in pixels, the height of the indicated string.
int xStringWidth (const char *textString)
 Returns the size, in pixels, the width of the indicated string.
void xText (float x, float y, const char *textString, bool centerx=false, bool centery=false)
 Prints a string at the designated screen coordinates.

Function Documentation

Font* xLoadFont ( const char *  name,
int  height,
bool  bold = false,
bool  italic = false,
bool  underline = false,
const char *  fontface = "" 
)

Loads a font and returns a font handle.

Parameters:
nameName of font to be loaded, e.g. "arial" or a path to the font file.
heightHeight of font in points
boldTrue to load bold version of font, false not to
italicTrue to load italic version of font, false not to
underlineTrue to load underlined version of font, false not to
fontfaceSpecify an exact name of the fontface if the engine fails to load the font using only the file name.
void xText ( float  x,
float  y,
const char *  textString,
bool  centerx = false,
bool  centery = false 
)

Prints a string at the designated screen coordinates.

Parameters:
xStarting x coordinate to print text
yStarting y coordinate to print text
textStringText to print
centerxTrue to center horizontally
centeryTrue to center vertically
void xSetFont ( Font *  font)

Activates a font previously loaded into memory (though the xLoadFont() command) for future use with printing commands such as xText().

If font handle is zero, the default engine font (Tahoma, 10) will be set.

Parameters:
fontFont handle
void xFreeFont ( Font *  font)

Frees up a font.

Parameters:
fontFont handle
int xFontWidth ( )

Returns the width, in pixels, of the currently selected font.

Use currently setted font by xSetFont() command.

int xFontHeight ( )

Returns the height, in pixels, of the currently selected font.

Use currently setted font by xSetFont() command.

int xStringWidth ( const char *  textString)

Returns the size, in pixels, the width of the indicated string.

This is useful for determining screen layout, scrolling of text, and more. This is calculated based on the size of the currently loaded font.

Parameters:
textStringAny valid string
int xStringHeight ( const char *  textString)

Returns the size, in pixels, the height of the indicated string.

This is useful for determining screen layout, scrolling of text, and more. This is calculated based on the size of the currently loaded font.

Parameters:
textStringAny valid string