2014 was one of the coldest and wettest summers in Austria ever recorded — which is good news for you, because it meant that I could spend more time in front of my Mac than usual. 😉
In other words: a lot has been going on in the Starling repository. It's high time to get all those new features in your hands! Thus, I've prepared a new release candidate for you, and I need as many users as possible to try it out!
Those of you who are following the Gamua blog might have seen an overview about the new version already (see Sprite3D and What's Next), but I want to give you a little more details in this post.
Here are the major new features:
Yes, you read right: finally, you can transform your Starling objects in a 3D space! That allows some really nifty effects, like 3D transitions between your Feathers screens — Josh is already working on that. 🙂
To try out this feature, simply create an instance of the new Sprite3D class and add children as usual. Then modify some of the 3D properties, especially "rotationX/Y" and "z". With a little trial and error, you might end up with a cube like this:
To modify the details of the 3D perspective, use the new properties on the Starling stage, namely "fieldOfView", "focalLength" and "projectionOffset".
Those changes are accompanied by a few new properties and methods on the base "DisplayObject" class, as well, namely:
transformationMatrix3D:Matrix3D — The 3D transformation matrix of the object relative to its parent.
is3D:Boolean — Indicates if this object or any of its parents is a 'Sprite3D' object.
getTransformationMatrix3D():Matrix3D — Creates a 3D matrix that represents the transformation from the local coordinate system to another.
globalToLocal3D():Vector3D — Transforms a point from global (stage) coordinates to the 3D local coordinate system.
local3DToGlobal():Point — Transforms a 3D point from the local coordinate system to global (stage) coordinates.
This gives you all the tools you should need to create whatever you have in mind. I'm looking forward to what you come up with!
If you need some help getting started, I created a small Video Tutorial (accompanied by a GitHub project) that shows you how to use that feature.
Enhanced Asset Management
The AssetManager now loads multiple assets in parallel. Even if you load your assets from disk, this will make the process much faster than before! Expect to have your assets ready in less than 50% of the previous time.
Furthermore, it's now simpler to load textures with different settings. Just follow this example:
var appDir:File = File.applicationDirectory;
var assets:AssetManager = new AssetManager();
assets.textureFormat = Context3DTextureFormat.BGRA;
assets.textureFormat = Context3DTextureFormat.BGRA_PACKED;
In other words, the "enqueue" method now remembers the settings you had on the AssetManager at the time you enqueued the asset, and creates the textures accordingly in the "loadQueue" method.
Furthermore, the AssetManager now dispatches "IO_ERROR", "PARSE_ERROR" and "SECURITY_ERROR" events if it runs into problems while processing the queue. That should allow you to handle those problems gracefully.
Nested Filters & better RenderTextures
In the past, Stage3D enforced a limitation that made it hard for me to make RenderTextures and Filters as flexible as I wanted them to be. With Flash/AIR 15, this limitation is finally gone, which allowed me to implement several changes:
* You can finally add a filter to a container that already contains filtered objects.
* Thanks to the same change, it's now possible to draw a filtered object to a RenderTexture.
* Furthermore, persistent RenderTextures require only 50% of the memory than before (because they could be implemented without double buffering).
Enhanced Button class
For those of you who are not using Feathers, I heavily extended the Button class. It now supports custom textures for the "over" and "disabled" states; you can modify the "color" of the textures or add objects to the new "overlay".
The complete list of changes is rather long — as always, you can find it on GitHub: CHANGELOG.md. If you're in a hurry, here's a summary of the most notable other changes:
* The TextField now supports HTML text for TrueType fonts.
* Starling has new method "stopFatal", displaying a panic message to the user.
* Added 'soundTransform' property to MovieClip class
* Added 'ignoreChildOrder' parameter to 'Sprite.flatten()' (for great performance!)
* Added modules and a project for IntelliJ IDEA (project found in
* BitmapFont composition now pools all internally used objects
* TextureAtlas now caches all SubTextures
* TextureAtlas caches list of available texture names
* AssetManager.loadQueue now processes font and atlas XMLs in separate steps
There's much more, of course, and it goes without saying that this release contains a huge number of bug fixes.
Where to get it
If you're using Git, a simple "pull" on the Starling repository will give you the release candidate. Others can download the complete release as a zip-file (including an updated "starling.swc" file).
Finally, I want to thank all of you for your support and help over the last months! None of those new features, optimizations and bug fixes would have been possible without your help — with numerous bug reports and pull request via GitHub or simply constructive criticism here in the forum. Thanks a lot for that!!! 😃
Last words: I'd appreciate if as many of you as possible could try out this version! As soon as I feel confident that this version is stable, I will publish it as a stable release. If any problems pop up — be it in the new features or with existing ones — I'll fix them ASAP.