Jump to content
  • Advertisement

Archived

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

FrikkaSoft

A Font question

This topic is 6268 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 have a problem drawing text using the D3DXCreateFont function. I figured out that the problem lies in this function. Everything compiles fine but the program won´t execute. it look´s like this: if ( FAILED( D3DXCreateFont( g_pd3dDevice, ?, g_pFont))) return E_FAIL; You can see that I put a ? where the handle to the font object is supposed to be. I tried NULL, 0 and HFONT. But nothing.. The SDK does not explain the handle to the font object HFONT in enough detail. Does anyone know a tutorial about the D3DXFONT interface.

Share this post


Link to post
Share on other sites
Advertisement
hehe.. Well the point of the D3DXCreateFont is to create a d3d version of a Windows font so the second parameter is a handle to a windows font. Try this

D3DXCreateFont ( g_pd3dDevice, (HFONT)GetStockObject ( SYSTEM_FONT ), &g_pFont );

Now there are two things that are different. The second parameter which loads a windows system font and the third parameter which takes a Pointer to a Pointer of type D3DXFont. Now from your declaration of g_pFont I assume you declared it like this LPD3DXFONT g_pFont. So you need to pass in the that pointer &g_pFont..

Hope this helps

------
Andrew T. Finnell
Software Engineer
e-Security Inc.

Share this post


Link to post
Share on other sites
If you don''t want to use a stock system font, use CreateFont() or CreateFontIndirect() with the parameters you want. In general, everything can be zero except for height, weight and the typeface (Arial, Tahoma, etc)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!