help ,about D3DXFont
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();
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,
but the tutorial is the dx8,and the font->begin(),->end() is Vanishes.(I think so)
could you give me a simple example,
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));
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));
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?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement