Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Drawing TrueType text
 Post Posted: April 7th, 2017, 1:01 pm 
 

Joined: April 7th, 2017, 12:57 pm
Posts: 1
Location: ex-Yugoslavia
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?


Top 
 Profile  
Reply with quote  
 Post Posted: April 8th, 2017, 3:39 am 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2711
Location: Oklahoma, United States
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.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 2 posts ] 

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: