Jump to content
  • Advertisement
Sign in to follow this  
wpyax

help ,about D3DXFont

This topic is 5105 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

it doesn't work.why? RECT x={ 0,100,0,100}; D3DXCreateFont(g_pd3dDevice,25,12,500,0,0,0,0,0,0,"Times New Roman",&font); font->DrawTextA(NULL,"aaaaaaaaaa",-1,&x,DT_TOP|DT_LEFT,D3DCOLOR_ARGB(255,255,0,0)); font->Release();

Share this post


Link to post
Share on other sites
Advertisement
thank you ,kovacsp
but the tutorial is the dx8,and the font->begin(),->end() is Vanishes.(I think so)

could you give me a simple example,

Share this post


Link to post
Share on other sites
Here is the code that works !!!

D3DXCreateFont(RenderDevice::lpDevice,20,0,1,1,true,
DEFAULT_CHARSET,
OUT_TT_ONLY_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,L"Arial",&pFont);
RECT r;
SetRect(&r,0,0,100,100);
pFont->DrawText(NULL,Str,-1,&r,DT_LEFT,D3DCOLOR_XRGB(255,255,255));

Share this post


Link to post
Share on other sites
Quote:
Original post by wpyax
it doesn't work.why?

RECT x={ 0,100,0,100};
D3DXCreateFont(g_pd3dDevice,25,12,500,0,0,0,0,0,0,"Times New Roman",&font);
font->DrawTextA(NULL,"aaaaaaaaaa",-1,&x,DT_TOP|DT_LEFT,D3DCOLOR_ARGB(255,255,0,0));
font->Release();


Is that copy and pasted straight from your code's "main" function? You should be initializing your D3DXFont object once in your startup routines, and only releasing once you're completely done with your D3DXFont object, which will likely be right before you exit your program. The only piece of that code that should be in your "main" function is the actual drawing of the text. I'm assuming your parameters are valid.

EDIT: Also, have you called ID3DXFont::Begin() before rendering and ID3DXFont::End() after rendering your text?

Share this post


Link to post
Share on other sites
ID3DXFont::Begin()
why i can't see it ?
this's my code :

LPD3DXFONT font = NULL;
D3DXCreateFont(g_pd3dDevice,25,12,500,0,0,0,0,0,0,"Times New Roman",&font);

and

font->Begin() is valid!

???????

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!