HFONT hFont = CreateFont(
30,
14,
400,
0,
NULL,
FALSE,
FALSE,
FALSE,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE,
"Arial" );
D3DCOLOR fontColor = D3DCOLOR_ARGB(255,255,0,0);
RECT rct;
ZeroMemory( &rct, sizeof(rct) );
m_pD3DXFont->Begin();
rct.left = 100;
rct.right = 500;
rct.bottom=50;
rct.top=100;
m_pD3DXFont->DrawText( "This is a test",15, &rct, DT_TOP , fontColor );
m_pD3DXFont->End();
[edited by - willywig on August 14, 2002 9:23:56 PM]
Help with ID3DXFont
When I create a font then change the orientation (in the createfont command) it gets clipped off has anyone had a similar problem or know how to fix it
I used the CD3DFont. Here is some sample code. I had
some trouble before also, but this worked for me.
The restore device call is pretty important, so do not
forget it.
CD3DFont* m_pFont
-init
m_pFont = new CD3DFont(_T("Arial"), 12, D3DFONT_BOLD);
hResult = m_pFont->InitDeviceObjects( lp3DDevice );
-After Reset device or initializing
m_pFont->RestoreDeviceObjects();
-Rendering
m_pFong->DrawText( x, y, SomeD3DCOLOR_ARGB, YourText );
some trouble before also, but this worked for me.
The restore device call is pretty important, so do not
forget it.
CD3DFont* m_pFont
-init
m_pFont = new CD3DFont(_T("Arial"), 12, D3DFONT_BOLD);
hResult = m_pFont->InitDeviceObjects( lp3DDevice );
-After Reset device or initializing
m_pFont->RestoreDeviceObjects();
-Rendering
m_pFong->DrawText( x, y, SomeD3DCOLOR_ARGB, YourText );
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement