Sign in to follow this  
wpyax

help ,about D3DXFont

Recommended Posts

wpyax    100
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
wpyax    100
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
stalion76    122
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
wpyax    100
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

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