AndEngineTexturePackerExtension

  ... information about changes and new features of AndEngine,

AndEngineTexturePackerExtension

Postby Nicolas Gramlich » Mon Aug 01, 2011 11:38 pm

Hello Community,

AndEngine is now able to read a format exported from the awesome sprite-packing tool called TexturePacker ( http://www.texturepacker.com/ ), written by Andreas Löw. The tool has a free version, which shows you how powerful this tool is. The pro version with all features is definitely worth it's money and if you cannot afford it now, then TexturePacker is definitely worth investing your first revenue you made with your previous app.

The special thing is that it will come with compile-time safety of accessing the sprites on the spritesheets, kind of similar to accessing i.e. resources like R.drawable.something. Combined with a few new commandline parameters introduced in the upcoming version of TexturePacker, you'll be able to create/update your spritesheets with one click and have instant compiletime safety in your code! How awesome is that :?:

You can download TexturePacker here: http://www.texturepacker.com/download/

The extension code is located here: http://code.google.com/p/andenginetextu ... extension/

The example is located here: http://code.google.com/p/andengineexamp ... ample.java

An example buildscript is located here: http://code.google.com/p/andengineexamp ... esheets.sh

The buildscript is well documented, and all you need to change are the UPPERCASE variables in the top.
When running the script:
  1. The images get combined into one/more spritesheet(s)
  2. An XML File is being created that contains meta-information on where the images are located in the spritesheet and information about rotation, trimming and finally an ID.
  3. A Java interface is generated that looks like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package org.anddev.andengine.examples.spritesheets;
  2.  
  3. public interface TexturePackerExampleSpritesheet {
  4.         public static final int FACE_BOX_ID = 0;
  5.         public static final int FACE_CIRCLE_TILED_ID = 1;
  6.         public static final int FACE_HEXAGON_TILED_ID = 2;
  7.         public static final int FACE_TRIANGLE_TILED_ID = 3;
  8. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


The great thing is that you can reference the TextureRegions in the SpriteSheet not by their name (which is error-prone), but by an ID (which means compiletime safety :!:)

If that is not great, I don't know :)

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: AndEngineTexturePackerExtension

Postby natypc » Tue Aug 02, 2011 8:22 am

Great! Thanks Nicolas :)
natypc
 
Posts: 18
Joined: Thu Jul 21, 2011 2:04 am

Re: AndEngineTexturePackerExtension

Postby pep_dj » Fri Aug 05, 2011 3:42 pm

Great! Thanks!
Image
pep_dj
 
Posts: 170
Joined: Fri Nov 12, 2010 9:05 pm

Re: AndEngineTexturePackerExtension

Postby Nicolas Gramlich » Fri Aug 05, 2011 8:44 pm

Hi,

it will take until Wednesday for TexturePacker to support all planned parameters (Andreas is on vacation currently, and we don't want to destroy it :) )

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: AndEngineTexturePackerExtension

Postby borrrden » Sat Aug 06, 2011 6:53 am

Wednesday! Great! Almost perfect timing, the iOS version of my current work project is just about finished, planned for final testing starting Tuesday. After that I will be going full steam ahead on the Android port. AndEngine seems to be coming along very well. I just worry about performing well on various hardware.
borrrden
 
Posts: 8
Joined: Mon Aug 01, 2011 12:06 pm

Re: AndEngineTexturePackerExtension

Postby Rev.Tyler » Sat Aug 13, 2011 10:41 pm

Any update on this?
Rev.Tyler
 
Posts: 161
Joined: Tue Dec 28, 2010 5:02 am

Re: AndEngineTexturePackerExtension

Postby vertti » Mon Aug 15, 2011 11:27 am

Straight from the horses.. I mean developers mouth:

"Btw. AndEngine is officially supported since yesterday ;-)"

That was from an email conversation yesterday with Andreas, developer of TexturePacker.
Catch me on Twitter and our development blog.
Check out our game SCAWAR Space Combat and it's trailer.
Image
vertti
 
Posts: 82
Joined: Fri Jul 08, 2011 11:19 am
Location: Finland

Re: AndEngineTexturePackerExtension

Postby borrrden » Mon Aug 15, 2011 12:13 pm

Does it still not support trimming? :-S The option is grayed out. Also there is a bug. If your filename start with a number, Java will be upset when the variable name starts with a digit, so beware.

EDIT: Upon looking at the XML, it seems the reason trimming is grayed out is because trimming is on by default with no way to disable it. That's totally fine. Although I get an error when I try to use the source from the andextensions page (unexpected end tag <TextureAtlas>)

EDIT AGAIN: I am stupid and I was using an old XML file, it looks like trimming is NOT supported. Is this feature coming?
Last edited by borrrden on Tue Aug 16, 2011 6:20 am, edited 1 time in total.
borrrden
 
Posts: 8
Joined: Mon Aug 01, 2011 12:06 pm

Re: AndEngineTexturePackerExtension

Postby Nicolas Gramlich » Tue Aug 16, 2011 12:13 am

*update*, see above.
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: AndEngineTexturePackerExtension

Postby Rev.Tyler » Tue Aug 16, 2011 12:53 am

Could you show how to make a TiledTextureRegion with the sprite sheets in the example?

*edit* nevermind, You can just use the TiledTextureRegion constructor, correct? Just get the texture and region position from the texture pack.

Will there ever be a way to create an animated sprite out of a series of texture regions so we can just use Texture Packer for animations without having to make a TiledTextureRegion on top of the TexturePack?
Rev.Tyler
 
Posts: 161
Joined: Tue Dec 28, 2010 5:02 am

Next

Return to Updates

Who is online

Users browsing this forum: No registered users and 4 guests