🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

HUD changes

Published July 04, 2008
Advertisement
To make way for some functionality I'm implementing in the map editor (I think I'll call it Creditor), I had to go, ah, "under the HUD" to change a few details. One notable change is that the statinfo class stores a pointer to an "IStringable" interface, which defines an abstract ToString() function. This didn't require as much code change as I thought it would, which is good. I derived a Stat template class which defines its ToString() method as lexical_cast'ing the stat and returning the result. If lexical_cast throws an exception, I return a blank string instead.

The root reasons for doing this is because (1) someone on IRC told me it was pretty limiting to only be able to use integers, and (2) because I wanted to be able to have my menu options as actual words, and be able to change their color or whatnot at the same time (DrawStatic is pretttty clunky for that).

I also made some fixes to some silly errors I made in the original HUD implementation. I had a cctor and an op=, but I was only copying the value of the buffer pointer over. They basically pointed to the same buffer after the operation. That's not good, especially because that would mean the two objects' destructors would delete the same memory twice. Idiot.
Previous Entry USC, SAT, WTF OMG BBQ!
Next Entry Screenie
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement