Created
January 5, 2014 17:25
-
-
Save illuzor/8271063 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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