Planet Chili
http://forum.planetchili.net/

Drawing TrueType text
http://forum.planetchili.net/viewtopic.php?f=3&t=3993
Page 1 of 1

Author:  LukaTheSerb [ April 7th, 2017, 1:01 pm ]
Post subject:  Drawing TrueType text

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:
Code:
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();
}

Any help?

Author:  albinopapa [ April 8th, 2017, 3:39 am ]
Post subject:  Re: Drawing TrueType text

Should you really be creating and releasing fonts in the same function every frame? Not as if that is the problem. You need to upload your project for better help.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/