text on 2d tiles in DirectX?

This is a discussion on text on 2d tiles in DirectX? within the Game Programming forums, part of the General Programming Boards category; I'm looking for any advice on the best way to draw text onto 2d tiles. I'm working on a simple ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    847

    text on 2d tiles in DirectX?

    I'm looking for any advice on the best way to draw text onto 2d tiles.

    I'm working on a simple 2d tile engine and will be using D3DXFont to draw the text that apears on the tiles. I want to avoid calling D3DXFont serveral times per frame.

    I'm thinking of drawing the text of all visible tiles to one texture. The two things I'm not sure about are how to draw to a texture with D3DXFont and once I have a texuture containing the visible texts how to properly update it when a new tile comes into view.

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    IS D3DXFONT really that slow that you don't want to call it too often?

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    It's actually not all that slow but when I have a lot of tiles each with text I'd rather not. Another problem is clipping. D3DXFont will draw from the top and left of the rectangle and can be set to use the bottom and right co-ordinates for clipping but I know of no way to clip the left/top part of the font when the text is partly off the left or top of the tile map (unless I have the text in a texture then I just update the texture co-ordinates.

    What I might do in the interest of simplicity is instead of trying to draw fonts to the "text texture" when they come into view, just create one large texture that contains all of the text of the entire map.
    Last edited by Quantum1024; 04-26-2006 at 10:25 AM.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    SetViewport()

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Of course, thanx Bubba.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 01:23 AM
  2. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  3. Replies: 1
    Last Post: 07-13-2002, 06:45 PM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 10:45 PM
  5. displaying text with DirectX
    By MechanicX in forum Game Programming
    Replies: 4
    Last Post: 09-24-2001, 07:28 PM

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