Shape Renderer


Shape Renderer

The Shape Renderer is a vector based renderer used to display simple shapes like a circle or square. It is based on the Sprite Renderer. You can change the fill color, fill alpha, line color, line thickness, and line alpha.


Code Sample

var entity : IEntity = PBE.allocateEntity();

//Used with a Basic 2D Scene
//var shapeRenderer : SimpleShapeRenderer = new SpriteSheetRenderer();
//Used with a Bitmap Renderer Scene
//var shapeRenderer : BitmapShapeRenderer = new BitmapShapeRenderer();

//Used with a Starling G2D Scene
var shapeRenderer : BitmapShapeRendererG2D = new BitmapShapeRendererG2D(); = true;
shapeRenderer.fillColor = 0xFF0000; //RED
shapeRenderer.fillAlpha = 0.8;
shapeRenderer.lineSize = 2;
shapeRenderer.lineColor = 0x000000; //BLACK
//Add to a scene to be displayed.
shapeRenderer.scene = scene;
entity.addComponent(shapeRenderer, "ShapeRenderer");

Follow Us For Updates