[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes how to draw text.
Before you can use text you need a font first. Typically you load a font in an initialization routine. Here is an example:
iGraphics2D* g2d = ...; iFontServer* fontserver = g2d->GetFontServer (); iFont* font = fontserver->LoadFont (CSFONT_COURIER); |
A number of fonts are available for use. See section Using a Custom Font.
To draw the text you must first make sure you are in 2D mode. Here is
how it would work (this code could be put after the call to let the engine
draw (view->Draw()
):
g3d->BeginDraw (CSDRAW_2DGRAPHICS); int fg = g2d->FindRGB (255, 0, 0); // Red. int bg = -1; // Transparent. g2d->Write (font, x, y, fg, bg, "This is text"); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated using texi2html 1.76.