Jump to content
  • Advertisement
Sign in to follow this  
SystemFiles

Best Performance for ID3DXFont

This topic is 3029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heey GameDev, I want to know how I can get the best performance for ID3DXFont. The quality is no problem here is my code: D3DXCreateFont( oDevice, 13, 0, FW_NORMAL, 0, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, DRAFT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "MS Reference Sans Serif", &oFont ); HRESULT CDraw::DrawText( FLOAT X, FLOAT Y, D3DCOLOR dColor, CONST PCHAR cString, ... ) { CHAR cBuffer[101] = ""; va_list oArgs; va_start( oArgs, cString ); _vsnprintf( ( cBuffer + strlen( cBuffer ) ), ( sizeof( cBuffer ) - strlen( cBuffer ) ), cString, oArgs ); va_end( oArgs ); RECT oRect1 = { X, Y, X + 500, Y + 50 }; if( dColor != dBlack ) { RECT oRect2 = { X - 1, Y, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect2, DT_NOCLIP, dBlack ); RECT oRect3 = { X + 1, Y, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect3, DT_NOCLIP, dBlack ); RECT oRect4 = { X, Y - 1, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect4, DT_NOCLIP, dBlack ); RECT oRect5 = { X, Y + 1, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect5, DT_NOCLIP, dBlack ); } oFont->DrawText( oSprite, cBuffer, -1, &oRect1, DT_NOCLIP, dColor ); return D3D_OK; }

Share this post


Link to post
Share on other sites
Advertisement
You may use a sprite to draw your text. I havn't done this yet, but you just have to look at the ID3DXFont-Article in the DirectX documentation for more information.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!