Help! TextOut With D3D

Started by
0 comments, last by Rhuno 20 years, 1 month ago
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]
The President has been kidnapped by ninjas. Are you a bad enough dude to rescue the President?
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
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )

This topic is closed to new replies.

Advertisement