Untitled

posted in DruinkJournal
Published August 17, 2006
Advertisement
I tightened up my graphics. My font manager now squishes all the glyphs together onto the texture instead of listening to the GDI's text metrics (Which fucking lie) and using 64x64 regions for each glyph. The GetTextMetrics function says that the widest glyph in the 12pt ariel font is 62px wide. Wtf. So I went and checked. It's fucking lying - Calling GetTextExtentsPt32W (Or whatever it's called) on each ofthe 65536 characters tells me the widest glyph is 16px wide.

So anyway, I now just increase X by the width of the glyph on the texture, and I keep track of the tallest glyph on that row so I can advance downwards a bit more whenI run out of space on that row. I was quite surprised that it worked first time.

The main reason I was doing what I did before was so I could unload random glyphs whenever I wanted to. However, that's just silly - why would I ever need to? I added the ability to trash all textures used by a font, which will free texture memory, at the risk of duffing up any fonts that are active. Still, useful for doing when changing graphics state (E.g. front end -> in game).

Still to do: Word wrap. Once that's done, I'm considering my 2d engine code "Done". I can do pretty much anything I want now, I can draw 2d quads (sprites) with or without a texture, blended with a (single, not per-vertex) diffuse colour, I can draw text in a rectangle with left, center, right, top, middle, bottom alignment (Like DrawText()), I'll soon have word wrapping, and the fonts can be any system font, unicode, bold, italic, stikeout, underline or any combination of the above.
I'm debating doing 3D stuff just now or not. I want to have a bit of a code tidy / optimize, then I'll probably release what I have for people to play with / inspect.

I have a weeks holiday at the start of September, so I want to get some serious work done to TEH MMORPG!!1 (As in, working 9 hours a day or so on it), and I'd like to get some articles and things written for both my site and GameDev.Net if they want them. Articles I'm going to be writing include:
  • Using Ogg Voribs to play streaming music with DirectSound
  • Creating a generic resource manager
  • Creating a texture manager with texture palettes in D3D9
  • ID3DXFont and ID3DXSprite: How do they work?
    And I have more on my list at home, but that's all I can think of just now.

    Let me know if there's any others you'd like to see.
  • Previous Entry Untitled
    Next Entry Untitled
    0 likes 8 comments

    Comments

    noaktree
    # Creating a generic resource manager
    # Creating a texture manager with texture palettes in D3D9

    I'd read these. I've yet to implement any resource mangement with D3D9.

    I'm interested in testing your 2D engine out.
    August 17, 2006 06:31 AM
    jollyjeffers
    I'm going to disagree with Neil [razz]

    Either the first or the last option. I'd be particularly interested in the Ogg Vorbis one - given that DMusic and DShow have (or are) going the way of the dodo it'd be nice to have an article to point people to when they ask in the forums.

    The latter one would be interesting, but probably more as an extended journal entry. You could always use your MVP powers to try and get some comment/info from the developers on the various points that you can't work out for yourself [wink]

    Cheers,
    Jack
    August 17, 2006 07:01 AM
    Evil Steve
    Yeah, the last one is mainly for my own site, and something to point people at when they say "Should I use ID3DXSprite/ID3DXFont" and whatnot.

    I've been meaning to write the Ogg Vorbis one for a while, the question keeps popping up in various places (For Beginners, General Programming, Game Programming anfd DirectX).
    August 17, 2006 07:55 AM
    Ravuya
    DX can't process Oggs natively?
    August 17, 2006 08:47 AM
    Evil Steve
    Quote:Original post by Ravuya
    DX can't process Oggs natively?
    DirectShow maybe can, but aside from that - no. DShow is horrible anyway.

    It's fairly straightforwards to get oggs playing, but there's pleanty to go wrong or cause odd problems.
    August 17, 2006 09:34 AM
    noaktree
    Jack's probably right. There appears to be a good deal of information on resource and texture management already available.
    August 17, 2006 10:22 AM
    Programmer16
    The HLSL article I sent you[razz]

    Seriously though, I'd really like to see the first option. I have a system setup, but it's quite flawed because I have no idea how it works.

    Holiday time FTW!
    August 17, 2006 05:11 PM
    You must log in to join the conversation.
    Don't have a GameDev.net account? Sign up!
    Advertisement
    Advertisement