Sparrow 1.1 hatched!

Daniel Sperl on January 13, 2011

The new year is just a few days old, but it has already been extremely busy for our bold little bird. It harnessed the holidays to gather new feathers, no: features and exercised in the gym to stay lightweight and agile. And here it is, better than ever: Sparrow 1.1!

Finally: Proper API documentation!

There is one thing our little bird was always a little ashamed of: the lack of a proper API documentation. While the Sparrow homepage does all it can to support users with a detailed introduction and regular blog entries with tutorials, there was no detailed documentation about all available classes and methods. We took great care that all method and class names are as self-explanatory as possible, but there were always chunks of information you could only find out by reading the source code - or by trial and error.

But those days are over! Click on the following URL to head over to the API reference page, containing information about every class and method of the complete framework:

Of course, it can also be integrated into Xcode! Just enter the Preferences window, find the “Documentation” tab and register the following URL by clicking “Add Publisher…”:

If that worked, a new button will appear (labeled “Get”). Click on that button, and you’re done! Sparrow will now appear in Xcode’s help window. One feature is currently not working, though: Xcode’s “Quick Help” does not yet pick up the new documentation. But that should be fixed within the next days.

The documentation was created using AppleDoc, a great and easy to use tool I can recommend to any Objective-C developer. While the latest version (2.0) is still in beta, it’s already working brilliantly. Use AppleDoc to create beautiful documentation that looks just like that of Apple itself.


When you browse over that API reference, you might stumble upon a class you’ve never seen before: SPRenderTexture. That’s alright, because this is a new class, and probably the most interesting new feature of Sparrow 1.1.

The render texture is a special kind of texture. It acts as a canvas on which you can draw other display objects. Here is a sample on how to do it:

// create the render texture
SPRenderTexture *renderTexture = [[SPRenderTexture alloc] 
		initWithWidth:200 height:200];	

// draw an object on that texture
[renderTexture drawObject:someDisplayObject];

// now display the render texture on an image
SPImage *image = [SPImage imageWithTexture:renderTexture];

The advantage of such a texture is that it will always be rendered in the same speed as an ordinary texture, no matter how many objects you have drawn onto it. Use that feature for cool special effects, like bullet holes or foot prints. You could even make a simple drawing application with Sparrow! An updated scene in the demo project shows you the basics of how this can be done.

"Render Texture"

This class was heavily inspired by a contribution of the Sparrow user “Pixelrevision”. Thanks for the help and feedback!

Looping Tweens!

For the first time, Sparrow contains contributions of other developers. The Sparrow user “Shilo” (you might know him from a recent blog entry) created a lot of add-ons for Sparrow, and some of them have already made it into this version. The most notable addition is that tweens can now loop!

You can either let a tween start again when it has finished, or let it reverse smoothly to the starting point. You just have to assign the appropriate value to the loop property of SPTween:

SPTween *tween = [SPTween tweenWithTarget:image time:5.0f];
[tween animateProperty:@"x" targetValue:310];

tween.loop = SPLoopTypeRepeat;
// or
tween.loop = SPLoopTypeReverse;

Shilo, thanks a lot for that contribution!


Another tiny, but helpful little class is SPUtils. This class contains helper methods that come in handy in different situations. It’s still relatively small, but I’m sure everybody will be happy about what it contains already: simple methods for random number generation.

int randomInt = [SPUtils randomIntBetween:5 and:10];
float randomFloat = [SPUtils randomFloat]; 

Other changes

That’s not all, of course. Here is a list of the notable other changes we’ve introduced in this version.

  • added support for uncompressed PVR texture formats (565, 5551, 4444)
  • added new transition method: ‘randomize’
  • added simple way to use HD textures on the iPad (more info here, blog article to follow)
  • added support for creating dynamic texture atlases (add/remove regions on the fly)
  • added new init method to SPImage: initWithContentsOfImage:(UIImage *)image
  • added methods to access the glyphs of SPBitmapFont directly
  • added support for changing the fps of an SPMovieClip at runtime (thanks to Shilo!)
  • updated SPView class to be more robust
  • Fixed several small bugs (thanks to Kodi, Matt Davies and others!)
  • Special thanks to numerous forum members for bug reports, suggestions and feedback!

Get it now!

As always, I hope you are happy about our selection of changes! The framework is as small and lightweight as before, nevertheless it empowers you with many new possibilities. A lot of work went into the API documentation, and I’m glad it’s now finally available for everyone.

If you find any problems with the new version, you can always reach us via mail or in the forum. I’m looking forward to all the ideas and projects you will create with this and future Sparrow versions! Don’t forget to contact us when you have released an app! We will gladly add it to the In Action page.