Wednesday, December 11, 2013

My Texture Packer 3.2.1 Update for C++

I grabbed the latest Texture Packer last week as it has had several modifications recently. Though in all honesty I didn't really NEED anything new. What got me intrigued though was the statement that I could now output Header files.

I am using C++ and so it is really useful to have a header file with the name of the graphic element in an enumeration so I can use this name all over my code for the drawing of my sprites. What I have been doing is writing all my data out into a *.cpp file and simply cutting the table from the bottom of the file, and then pasting it into my header file. A simple enough process when I update my graphics. However it can get tedious, just a little bit.

So back to the 3.2.1 texture packer. I was excited about the ability to simply cut out my cut and paste stage so figured the update would be good. I have to say that the updates are always smooth and seamless with this useful tool, and this time was no exception.

So then I created what I needed to for creating my header file and stopped the bit of code creating the enum data in the cpp file. As it happens it mean't I simply copied script from the cpp creating to the header creation.

Now although this sounds great and all dandy. It wasn't, or isn't. In fact it simply doesn't work at this time. I have emailed Andreas with a question in respect to me messing this up and am just waiting on a reply at the moment. Still I figured anyone else trying this might be interested to read my problems, or if they have the secret sauce they may be able to share some with me. As I would love to have this working.

What happens?
Well the header creation does in fact happen. Only the values I use in the main reference file creation are all null. So if I ask for any value I simply get an empty string printed. I am not sure why. I really thought it would work the same as the main reference file output.

I will of course do an update when I find out more on this, but if you can help me, then please message me on twitter, or email, or post in the comments.

Da Voodoocheif


  1. Sounds promising. Right now, I output all the bits of data I need to a single output file and copy paste the snippets into my various .cpp and .h files. Not terrible, but brittle and prone to user error :)

    BTW, your comment is broken .. at least using my Google profile. No error message, but it don't post a damn thing :)

  2. Eww, that sounds horrible. At least I only have one cut and paste to make. Been like this for a year now, so it's no biggie for me. Just would be nice if I didn't have too, though your method sounds painful haha.

    I have no idea about comments being broken, this is after all a google site and service. So no idea why it wouldn't work.

    Da Voodoochief