View Full Version : Text on a DirectDraw surface
jdinger
03-29-2002, 06:38 PM
In VB there's a DirectDraw method to write text to the surface; ie:
ddsBackBuffer.DrawText x,y,"text",trans
Is there a similar function in VC++? Or would I have to use the GDI to write text to the back buffers hDC (ie: TextOut)? I know how to use TextOut but it always leaves a white background around the text it writes.
Thanks..
lightatdawn
03-29-2002, 07:38 PM
There is a way to mask the background of TextOut but i cant seem to find the code. Alternatly one could use LPD3DXFONT and use the DrawTextA method of it (after creating the HFONT with CreateFont() and calling D3DXCreateFont() to set it all up). Your DX help files should give you the specifics on those functions.
jdinger
03-29-2002, 10:07 PM
Thanks. I haven't really played around with D3D at all yet. I've been writing with DirectDraw for about 8 months now (mostly in VB, except the last month or so when I made the move to C++).
Do you know if it's possible (or even practical) to mix D3D and DD in the same app (so far the only use for D3D that I'd have would be text). As I understand it, I'd have to initialize all the D3D stuff and for my 2D stuff use my bitmaps as textures on rectangular polygons.
Not sure if I want to take that leap right now since I've got the starting draft of my design document almost completely finished (just fleshing out some of the classes right now) and the game graphics' engine is all 2D stuff in DirectDraw.
lightatdawn
03-29-2002, 10:44 PM
D3D can be easily used with DDraw. Which version of the DX SDK are you using?
Dual-Catfish
03-29-2002, 11:39 PM
Originally posted by jdinger
I know how to use TextOut but it always leaves a white background around the text it writes.
CDC::SetBkMode(TRANSPARENT); //will remove the white 'background' from the text
jdinger
03-30-2002, 11:03 AM
Thanks, Dual-Catfish.
lightatdawn, I'm using the DX 7.0 SDK. Thanks again.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.