Jump to content
  • Advertisement
  • entries
  • comments
  • views

Quest for Game Glory IV: Shadows of Fontness

Sign in to follow this  
Trapper Zoid


After feeling slightly pleased with my "lattice 'o squares", I've noticed that the background is stuttering slightly while scrolling. It could be because I'm not waiting for the vertical retrace (mainly because I don't know how to do that yet in OpenGL under SDL [smile]), so I decided to figure out how to display text in my system, thinking it would be easy for me to do under SDL.

I was wrong.

First I figure out that SDL_ttf is an add-on package, so I find a copy of the DLL, stupidly forgetting that I'll also need both the header and a link library to actually compile the thing. I get a copy of the binaries, but I forget that the Visual C++ libraries aren't going to work with the MinGW compiler, so I have to make my own. Of course, the source code configuration script needs bash to actually run, which isn't much use on Windows XP. I think this is the point where I started swearing non-stop at the computer.

Finally I hack together a version of the code that will compile, and get my game all linked together, only to have the thing seg fault on me. It seems SDL blitting and OpenGL don't like to run together. A change of initialisation flags that the documentation said would allow the two to work together caused the seg faults to go away, but it didn't cause the "Hello World!" text to display in the game. It's possible I'm not calling the right update function to SDL, or double buffering is causing some weirdness. I guess I've just got to learn more SDL and OpenGL, because at the moment I know next to nowt about either of them (I hate dealing with all this fiddly API stuff).

On top of it all, I don't think I'll be even using fonts in my final version of the game; I'm aiming to use no external bitmaps at all, only geometric shapes. I'll have to roll my own font system anyway. But it does bug me I couldn't figure this out in an evening. I think I might just stick with OpenGL for 2D graphics (I can use textured quads for displaying bitmaps), and use SDL for initialisation and handling the input. But I still don't know how to display fonts and text in OpenGL, so I'd better read a bit more about it.

That reminds me; a huge box of books I ordered from Amazon arrived yesterday, and included was the OpenGL Superbible (by far the most expensive book in the set), so hopefully that will speed up things. There's a chapter on fonts in there, but skimming through it it seemed to imply it wasn't cross-platform. I'll figure out something using FreeType, I'm sure.

It's always cathartic to rant about programming annoyances in a journal. As always, any helpful advice would be welcome, as I don't really know what I'm doing [smile].
Sign in to follow this  


Recommended Comments

I use bitmap fonts for this reason- and did you check out the memory bloat that linking against freetype (as SDL_ttf) gives you?

Share this comment

Link to comment
I haven't checked the memory requirements of my game yet; I don't think I've coded an easy way to figure that out too (I suppose I could just check it through the System Manager for now)?

I'll figure out which method I'll use when I need to implement fonts in my game. I used to use bitmap fonts in my old DirectX engine, but it was a pain to implement.

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!