Jump to content
  • Advertisement


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


CD3DFont unresolved external

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

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 );
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
m_pFont->DrawText( 2, 0, D3DCOLOR_ARGB(255,255,255,0), "hello my name is Valles" );
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
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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!