Game Development Reference
In-Depth Information
pText —Pointer to a null-terminating string specifying the text to
create a mesh of
Deviation —Maximum chordal deviation from TrueType font out-
lines. This value must be greater than or equal to 0. When this
value is 0, the chordal deviation is equal to one design unit of the
original font.
Extrusion —The depth of the font measured in the negative
z-axis direction
ppMesh —Returns the created mesh
ppAdjacency —Returns the created mesh's adjacency info. Spec-
ify null if you don't need this.
pGlyphMetrics —A pointer to an array of LPGLYPHMETRICS -
FLOAT structures that contain the glyph metric data. You can set
this to 0 if you are not concerned with glyph metric data.
The following example code shows how to create a 3D mesh of text
using this function.
// Obtain a handle to a device context.
HDC hdc = CreateCompatibleDC( 0 );
// Fill out a LOGFONT structure that describes the font's properties.
LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
lf.lfHeight
= 25;
// in logical units
lf.lfWidth
= 12;
// in logical units
lf.lfWeight
= 500;
// boldness, range 0(light) - 1000(bold)
lf.lfItalic = false;
lf.lfUnderline = false;
lf.lfStrikeOut = false;
lf.lfCharSet = DEFAULT_CHARSET;
strcpy(lf.lfFaceName, "Times New Roman"); // font style
// Create a font and select that font with the device context.
HFONT hFont;
HFONT hFontOld;
hFont = CreateFontIndirect(&lf);
hFontOld = (HFONT)SelectObject(hdc, hFont);
// Create the 3D mesh of text.
ID3DXMesh* Text = 0;
D3DXCreateText(_device, hdc, "Direct3D", 0.001f, 0.4f, &Text, 0, 0);
// Reselect the old font, and free resources.
SelectObject(hdc, hFontOld);
DeleteObject( hFont );
DeleteDC( hdc );
Search WWH ::




Custom Search