When Starling was created to help developers get a head-start on Stage3D powered games, it was great to see that all the traditional Flash display objects were replicated in the same naming convention, just different package (starling.display.* instead of flash.display.*)
There was an exception to the group, until today.
This area requires
Adobe FlashPlayer version 11.2 or above.
iOS Devices are not currently supported.
Where to find it?
You can find the source code and examples on GitHub:
Thanks to Robert Silverton (@robsilv) and Jon Pace (@JonathanRPace and @unwrong), this extension will allow you to call the Graphics method you’re used to invoke on traditional Flash DisplayObjects (Shapes and Sprites, to be specific).
These are the currently supported methods:
- beginFill(color:uint, alpha:Number = 1.0);
- beginBitmapFill(bitmap:Bitmap, matrix:Matrix = null, repeat:Boolean = true):void;
- beginTextureFill( texture:Texture, matrix:Matrix = null ):Fill;
- drawCircle(x:Number, y:Number, radius:Number):void;
- drawEllipse(x:Number, y:Number, width:Number, height:Number):void;
- drawRect(x:Number, y:Number, width:Number, height:Number):void;
- lineStyle(thickness:Number = NaN, color:uint = 0, alpha:Number = 1.0):void;
- lineTexture(thickness:Number = NaN, texture:Texture = null):void;
- lineTo(x:Number, y:Number):void;
- moveTo(x:Number, y:Number):void;
Most of those work the same as the original Graphics API. Some of them don’t have near as much parameters (assuming it’s because of some challenges in the GPU implementation).
However… There is some new methods too!
You must of stumbled upon the Texture / TextureAtlas class by now if you’ve worked in Starling. Well, there is methods that makes use of those resources! Now… how exactly does someone offset, scale, rotate or transform the texture, I’m not sure to be honest. I guess we will find out soon enough!
The potential behind an extension like this is great – Drawing apps, Charting libraries, Dynamic shapes in games, Polygons of more than 4 points (or just 3 even), etc.
This extension will open new doors!
Again, everyone should give a big thanks to Robert Silverton and Jon Pace, Thibault Imbert (@thibault_imbert) for tweeting the good news, and let’s not forget none of this would have existed without Starling in the first place! So Thanks to Daniel Sperl (@PrimaryFeather) and all of the community behind this framework.
Get drawing now! :)