Best Performance for ID3DXFont

Started by
2 comments, last by SystemFiles 14 years, 1 month ago
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; }
Advertisement
Also what is the best methode to DrawRectangles?
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.
Look at my code I already use a sprite, I will look at the articel.

This topic is closed to new replies.

Advertisement