Jump to content
  • Advertisement

Archived

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

Rhuno

Help! TextOut With D3D

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

Hey, I'm pretty new to this programming thing, and I'm having problems writing my score out to the screen. For some reason using the old GDI style isn't working to well, even if I get the back buffer's DC. Anyway, I was wondering if someone knew of an easy way to write text or integers out to the screen. Is there a special D3D function or something? Thanks. For reference, here's what I have so far: //in main loop: // 4 end scene pWrap->GetDevice()->EndScene(); ///points/////// wsprintf(szScore, "%d", Marle.GetPts()); pWrap->WriteScore(szScore); //////////////// /////////////// // 5 present pWrap->GetInstance()->PresentBackBuff(); //Here is the WriteScore function: void CD3dWrap::WriteScore(char* szOut) { LPDIRECT3DSURFACE9 pbuffer = 0; m_d3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pbuffer); HDC dc; pbuffer->GetDC(&dc); SetBkMode(dc, TRANSPARENT); SetTextColor(dc, RGB(0, 200, 0)); TextOut(dc, 410, 0, szOut, strlen(szOut)); pbuffer->ReleaseDC(dc); SAFE_RELEASE(pbuffer); } [edited by - Rhuno on March 21, 2004 9:38:51 PM]

Share this post


Link to post
Share on other sites
Advertisement
Since you''re working in 3D, you''re going to have to use a 3D interface. Also, GDI is terribly slow.

ID3DXFont should work great for you. Are you using the summer update version of the SDK? I ask because ID3DXFont''s speed was greatly increased in that release (before, it was just a tad bit faster than gdi).

Check out the SDK docs for some help with ID3DXFont. Also, a search of this forum with yeild a lot of hits.


Dustin Franklin
Mircrosoft DirectX MVP

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!