Archived

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

Neen10do

CD3DFont unresolved external

Recommended Posts

i included D3DFont.h in my project, and i use this line of code to print text: myFont.DrawText(position.x,position.y,color,text); but it gives me unresolved external errors on taht function, and something about DrawTextA. im figuring that the GDI has a drawtext function too, do i have to set a name space, or how would i fix this? ---------------------- i code therefore i am. Aero DX - Coming to a bored Monitor near you!

Share this post


Link to post
Share on other sites
From what I know, you'll need d3dfont.h and d3dfont.cpp in your project and the following code:

#include "d3dfont.h"
CD3DFont* m_pFont; // Font for drawing text

LPDIRECT3DDEVICE8 g_pd3dDevice = NULL; // Your device that needs to be created before you initialize the font

m_pFont = new CD3DFont( _T("Arial"), 12, D3DFONT_BOLD );

m_pFont->InitDeviceObjects( g_pd3dDevice );
m_pFont->RestoreDeviceObjects();
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
g_pd3dDevice->BeginScene();
m_pFont->DrawText( 2, 0, D3DCOLOR_ARGB(255,255,255,0), "hello my name is Valles" );
g_pd3dDevice->EndScene();
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );

I took this straight from the matricies tutorial in DXSDK8.

- Valles

[edited by - valles on July 28, 2003 2:27:12 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by cryo75
every when do you need to call the RestoreDeviceObjects??

call it once after calling InitDeviceObjects, and call it again after calling InvalidateDeviceObjects everytime the D3D device is reset.

Share this post


Link to post
Share on other sites