Text on a DirectDraw surface

This is a discussion on Text on a DirectDraw surface within the Game Programming forums, part of the General Programming Boards category; 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 ...

  1. #1
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065

    Text on a DirectDraw surface

    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..

  2. #2
    Peace
    Join Date
    Aug 2001
    Posts
    1,510
    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.
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  3. #3
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    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.

  4. #4
    Peace
    Join Date
    Aug 2001
    Posts
    1,510
    D3D can be easily used with DDraw. Which version of the DX SDK are you using?
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  5. #5
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    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

  6. #6
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Thanks, Dual-Catfish.

    lightatdawn, I'm using the DX 7.0 SDK. Thanks again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another weird error
    By rwmarsh in forum Game Programming
    Replies: 4
    Last Post: 09-24-2006, 11:00 PM
  2. Couple of simple directdraw questions.
    By Deo in forum Game Programming
    Replies: 3
    Last Post: 05-25-2005, 08:55 AM
  3. Please help with my game
    By jjj93421 in forum Game Programming
    Replies: 10
    Last Post: 04-13-2004, 12:38 AM
  4. Windowed DirectDraw problems
    By Magos in forum Windows Programming
    Replies: 0
    Last Post: 01-20-2003, 01:00 PM
  5. Replies: 1
    Last Post: 07-13-2002, 06:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21