Allegro Game Programming Library
A Hardliner No More
By ZOMGxuan on 2010-10-20, 02:34:37

If you have ever looked at the source of Pixelchase (and let's face it, you haven't), you would have noticed one of the most horrifically ugly things in the world of programming: a humongous 20-line chunk of HARD-CODED TEXT. Yes, I can imagine you just writhing in pain as you read this. That text was used for display in the About screen. Now the Extremely Bad Thing about hard-coding large descriptive chunks of text like this is, if you change the description somewhere else (such as right in the ABOUT text file always shipped with the game itself), you have to change in the game as well, and then you have to recompile it, i.e. it is inconvenient, inefficient, and most probably inconsistent.

Alas, though, now we can all rejoice, for I have fixed the problem, by writing a whole set of functions meant to read text from a file, split it into paragraphs, and wrap each of those paragraphs to a maximum number of characters per line before displaying the whole thing on screen. Just to show you that I am actively developing this thing. Now, any change in the ABOUT file will result in a change in the text displayed in-game. Isn't that nifty?

By Anonymous on 2011-01-03, 18:41:36
I looked at the source once (in 2008 lol). That text-code amalgamation was painful to look at. Yes, you now know someone actually reads this. Ain't that satisfying?



Check this if you are not human:
Check this if you are human: