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

Some great libraries

Sign in to follow this  


You know, up until around 2 months ago I was using small libraries to do specific things. Like to create a sound model I used DirectSound, and Vorbis OGG. Now I see how much of a waste of time that was, why bother trying to reinvent the wheel when everyone gives you free better ones. I've created a new model for the engine, this time I'm using a plenty of good libraries (FreeImage, FMOD, TinyXML, PhysFS, and FlatLand). This should lay a good foundation for Hollow Halls, at least one that will allow quicker turn around time. I should talk about the game, but for now I'm going to keep quiet.

Now, this week I started working with TinyXML. I've never touched XML up until now, and I'm starting to grow attached to it. Now, the only real use I see for it at this stage in the game is to use it to define resources. Currently I am using it for storing stories, questions, answers, texture, font, sound, and sprite lists. The only real problem I see with the format is its "all out in the open" model, so this would mean that I would have to have a list of texture names that I would have to properly link with the XML file. Argh.

Anyhow, here is an interface that I wrote to extend the functionality of TinyXML handles. My original intention was to scrap the .Child idea, but I ended up tacking a few other features on.

//typedef TiXmlHandle XMLHANDLE;
typedef TiXmlElement XMLELEMENT;
typedef TiXmlDocument XMLDOCUMENT;

// designed to extend the functionality of TinyXML Handle
TiXmlHandle handle;

XMLHANDLE( TiXmlNode* node ): handle(node) {};
XMLHANDLE( const XMLHANDLE& ref ): handle(ref.handle){};
XMLHANDLE( const TiXmlHandle& ref):handle(ref){};
void operator=( const XMLHANDLE& ref ){ this->handle = ref.handle; };
void operator=( const TiXmlHandle& ref ){ this->handle = ref; };

inline XMLHANDLE FirstChild() const { return handle.FirstChild(); };
inline XMLHANDLE FirstChild( const char * value ) const { return handle.FirstChild(value); };
inline XMLHANDLE FirstChildElement() const { return handle.FirstChildElement(); };
inline XMLHANDLE FirstChildElement( const char * value ) const { return handle.FirstChildElement(value); };
inline XMLHANDLE Child( const char* value, int index ) const { return handle.Child(value, index); };
inline XMLHANDLE Child( int index ) const { return handle.Child(index); };
inline XMLHANDLE ChildElement( const char* value, int index ) const { return handle.ChildElement(value, index); };
inline XMLHANDLE ChildElement( int index ) const { return handle.ChildElement(index); };
inline TiXmlNode* Node() const { return handle.Node(); };
inline TiXmlElement* Element() const { return handle.Element(); };
inline TiXmlText* Text() const { return handle.Text(); };
inline TiXmlUnknown* Unknown() const { return handle.Unknown(); };

inline XMLHANDLE operator[](const char* value){ return handle.Child(value, 0); };
inline XMLHANDLE operator[](int index){ return handle.Child(index); };

inline void operator++(){
if(handle.Node() == NULL)
handle = NULL;
else handle = handle.Node()->NextSibling();

inline bool operator==(bool& ref){
return (handle.Node()!= NULL) == ref;

Anyhow, I've been spreading this post in little bits over the last 2 hours. I've lost what I was originally going to talk about.

Sign in to follow this  


Recommended Comments

There are no comments to display.

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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!