api breakage

Mario said recently, “No more API breakages until v1.0!”. Naturally, I stepped up to the challenge and broke the hell out of the API for you. It means a lot to us that you are willing to go to the trouble of doing the minor code fix-ups necessary for the API to improve. That you don’t have a choice is beside the point. Things are, of course, better now, and we won’t ever break the API again.*

So what changed? Uhg, it is all a blur now. I’ll ramble about some of the changes and let your trusty compiler tell you about any I miss. But don’t fret, all changes should be relatively straightforward to fix.

  • SpriteBatch and SpriteCache got a setColor method and the Color parameter has been removed from all draw methods. This is more efficient when drawing more than one sprite that is the same color as the last. It also reduces the number of arguments to the draw methods.
  • Sprite#setRepeat got moved to Texture#setWrap.
  • TextureRegion got an overhaul. It was mostly a placeholder before, now it has all sorts of nice methods to set the region, flip, scroll, etc.
  • Sprite now extends TextureRegion.
  • BitmapFont can now be based on a TextureRegion rather than Sprite.
  • SpriteBatch and SpriteCache got draw methods that take a TextureRegion.
  • SpriteSheetPacker became TexturePacker, and can now pack images fed to it manually in addition to processing directories of images.
  • SpriteSheet became TextureAtlas, replacing the old class. This class reads images packed by TexturePacker and provides them as TextureRegions or Sprites.

In addition to the API breaking changes above, over the past couple weeks there have been lots of minor improvements and quite a few bug fixes.

-Nate

* We will definitely break the API again.

2 thoughts on “api breakage

Leave a Reply

Your email address will not be published.