Sign in to follow this  
SystemFiles

Best Performance for ID3DXFont

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this