Archived

This topic is now archived and is closed to further replies.

Taulin

D3DFont, and KABOOM!

Recommended Posts

Howdy all! I saw in an MS example they used D3DFont, and it looked pretty easy. So, I thought I would give it a quick wirl, but it just blows up when I call DrawText All the MS example did was create it, and it was ready to go. m_pFont = new CD3DFont( _T("Arial"), 12, D3DFONT_BOLD ); m_pFont->InitDeviceObjects( m_lpDirect3DDevice ); m_pFont->DrawText( 10, 20, D3DCOLOR_ARGB(255,255,255,0), "Hello" ); However, as I just mentioned, bad things happen, exception wise, when I call drawText, but I can not get any meaningfull data back. My Question: Has anyone else used this class? Am I just missing a step? Question2: I can not find any documentation on this class, would anyone know what section it might be under? Thanks in advance! It will be greatly appreciated!

Share this post


Link to post
Share on other sites
Thats right, but you are supposed to have calls to restoredeviceobjects, deletedeviceobjects, and invalidatedeviceobjects in the right places also. Assuming you use the framework, new CD3DFont is supposed to be in your application class constructor. InitDeviceObjects is supposed to be in the CD3DApplication::InitDeviceObjects function, and DrawText should be in render.

Note that you cannot draw in CD3DApplication::InitDeviceObjects, as the device is not yet ready. Make sure you are calling all the functions in the right places. DirectX 8.1 SDK has a project wizard that will put the font calls in the proper places for you so you can see the order, if you need.

Share this post


Link to post
Share on other sites
Yea! Because of what you said, I discovered I indeed forgot
the RestorDevice. In fact, I had not looked at the source
so I was not aware RestoreDevice must be called.

Have you seen any documentation on the Common.cpp stuff,
like ArcBall and D3DFont?

Thanks for the quick help!

Share this post


Link to post
Share on other sites