Quick update

posted in Beals Software
Published July 10, 2007
Advertisement
Got some work done today, but most of my time was wasted playing through Oblivion (had to beat the main quest line so I could move onto the Shivering Isles and then I had to beat that lol.) Anyway, I'm pretty much just getting started. I have about 90 classes to go (at the moment; more than likely I'll add/remove some along the way), but almost half of them are GUI classes.

I'm spending a lot more time making sure things are consistent though. For example, the following would work for any of my math classes:
template  void Display(const ValueType &Value){    MessageBox(0, Value.ToString().c_str(), "Displaying value...", 0);}template  ValueType Load(std::ifstream &Stream){    char Buffer[256];    Stream.getline(Buffer, 255);    return ValueType::FromString(Buffer);}template  ValueType Load(TiXmlElement *Element){    return ValueType::FromXmlElement(Element);}

I wouldn't actually use any of them (other than for testing or something), but they would work for all of my classes. Hell, they'd ever work for some of my other classes.

I know I keep changing my plans, but I need to start thinking more about my future and less about practice. I'm going to do Chompy, Blocks Gone Wild, and Spelunker to test the engine, but then I'm going to focus on something else. I still plan on finishing Invasion, it's just going to take a little longer than I want it to.

I need to go to sleep now. kthxbai
Previous Entry Untitled
Next Entry New project
0 likes 2 comments

Comments

Tallitus
Wow, 90 classes? Seems like a bunch - would be interested in seeing the list :). Quick question on the code you posted:


template <typename ValueType> ValueType Load(std::ifstream &Stream)
{
    char Buffer[256];
    Stream.getline(Buffer, 255);
    return ValueType::FromString(Buffer);
}



Seems like that should be


template <typename ValueType> ValueType Load(std::ifstream &Stream)
{
    return ValueType::FromString(Stream);
}



I.e. why the 255 character limit instead of just having the underlying ValueType::FromString method read in the data it needs from the stream?
July 10, 2007 01:46 PM
Programmer16
Hm, I could probably post a list of all the classes I have planned. We'll see; I'm still ironing it out atm.

And it's done that way because the method is "FromString()" not "FromStream()" ~_^. As I said though, it's just an example. The method doesn't care how long the string is, it just needs to be in the format "Type(values)". For example, Point::FromString() requires "Point(x,y)", Rectangle::FromString() requires "Rectangle(left,top,right,bottom)" and Color::FromString() requires one of the following: "Argb(a,r,g,b)", "Rgb(r,g,b)", or "Named(color)".

Thanks!
July 11, 2007 12:07 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement