Drawing TrueType text
Posted: April 7th, 2017, 1:01 pm
Hi everyone, I'm new here and I hope I don't make a mistake by asking something here, but whatever...
Recently I wanted to draw truetype text instead the bitmap one you use in your framework. I tried using LPD3DXFONT and DrawTextA() but it seems that no text appear on screen. Is it a problem that this framework directly writes on video buffer and DrawTextA() on sprite, or what? I'm doing this:
Any help?
Recently I wanted to draw truetype text instead the bitmap one you use in your framework. I tried using LPD3DXFONT and DrawTextA() but it seems that no text appear on screen. Is it a problem that this framework directly writes on video buffer and DrawTextA() on sprite, or what? I'm doing this:
Code: Select all
void D3DGraphics::_DrawText(int x, int y, char* str, char* fontface, int size ,int r, int g, int b)
{
LPD3DXFONT Font;
RECT FontRect;
D3DXCreateFontA(pDevice, size, 0, FW_NORMAL, 1, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE, fontface, &Font);
SetRect(&FontRect, x, y, 800, 600);
Font->DrawTextA(NULL, str, 0, &FontRect, DT_LEFT, D3DCOLOR_XRGB(r, g, b));
Font->Release();
}