Sign in to follow this  

help ,about D3DXFont

This topic is 4397 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
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

This topic is 4397 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this