← Back

ofxTexturePacker

github.com/danoli3/ofxTexturePacker · @danoli3
OF 0.11 Animation Graphics

openFrameworks Addon for SpriteSheets and Animated Sprites generated from TexturePacker

26 6 Last commit 3y ago Created 12y ago

Branches ahead of master

These branches have commits not yet on master — could be unmerged fixes or work in progress worth a look.

fakelove-master 1 commit ahead · last commit 12y ago

README

ofxTexturePacker



Screenshot

OpenFrameworks addon for loading and rendering sprites and animated sprites generated from CodeAndWeb's TexturePacker application.

What is TexturePacker?



What is a Sprite Sheet? http://www.codeandweb.com/what-is-a-sprite-sheet

Get Texture Packer (has free to use version) http://www.codeandweb.com/texturepacker

What this addon does?





What export settings do I use in TexturePacker Application?



Why use this addon?





How to refactor an ofImage into ofxTPSprite:
// Turn:
ofImage  normal = new ofImage();
normal.loadImage("images/normal.png");
// Into:
ofxTPSprite  normal = texturePacker.getSprite("images/normal.png");


How to load an animated sprite
ofxTexturePackerPtr texturepacker;
ofxTPAnimatedSpritePtr spaceship_sprite;

texturepacker = ofxTexturePackerPtr(new ofxTexturePacker());
texturepacker->load("spaceship/spaceship.xml");
spaceship_sprite = texturepacker->getAnimatedSprite("spaceship");
spaceship_sprite->play();


Don't forget to update() your sprite.

Notes



ofxTexturePacker loads the png image designated by the xml file using a path relative to the xml file's location. getAnimationNames requires that you name your sprites with a common prefix

Still a work in progress. Will be maintained.

Get this addon

HTTPS
SSH