Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  
Evil Steve


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.
  • Sign in to follow this  


    Recommended Comments

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

    Share this comment

    Link to comment
    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]


    Share this comment

    Link to comment
    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).

    Share this comment

    Link to comment
    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.

    Share this comment

    Link to comment
    Jack's probably right. There appears to be a good deal of information on resource and texture management already available.

    Share this comment

    Link to comment
    Guest Anonymous Poster


    Steppy, I was really excited when I realised you had a journal, but I don't understand anything you ever write about. A line at the bottom of each post about something you've just done, wouldn't hurt now, would it?

    Kat x

    Share this comment

    Link to comment
    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!

    Share this comment

    Link to comment

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Advertisement

    Important Information

    By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

    GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

    Sign me up!