Skip to content

Instantly share code, notes, and snippets.

@illuzor
Created January 5, 2014 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save illuzor/8271063 to your computer and use it in GitHub Desktop.
Save illuzor/8271063 to your computer and use it in GitHub Desktop.
package {
import flash.display.Bitmap;
import starling.display.Shape;
import starling.display.Sprite;
import starling.events.Event;
import starling.textures.Texture;
public class GraphicsTest extends Sprite {
[Embed(source = "../assets/single_image.jpg")]
private const ImageClass:Class;
public function GraphicsTest() {
addEventListener(Event.ADDED_TO_STAGE, onAdded);
}
private function onAdded(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, onAdded);
var testShape:Shape = new Shape();
addChild(testShape);
testShape.graphics.beginTextureFill(Texture.fromBitmap(new ImageClass() as Bitmap));
testShape.graphics.drawRect(0,0,stage.stageWidth, stage.stageHeight);
testShape.graphics.endFill();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment