Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- import openfl.system.System;
- //import scenes.Scene;
- import starling.events.Event;
- import starling.display.Sprite;
- import starling.display.Quad;
- import starling.display.Canvas;
- import starling.display.Image;
- import starling.textures.Texture;
- import starling.extensions.TextureMaskStyle;
- import starling.utils.AssetManager;
- @:keep class MainClass extends Sprite
- {
- private static var sAssets:AssetManager;
- public function new()
- {
- super();
- // nothing to do here -- Startup will call "start" immediately.
- }
- public function start(assets:AssetManager):Void
- {
- sAssets = assets;
- showMask();
- }
- private function showMask():Void
- {
- // now would be a good time for a clean-up
- #if 0
- System.pauseForGCIfCollectionImminent(0);
- #end
- System.gc();
- var canvas:Canvas = new Canvas();
- canvas.beginFill(0x00FF00);
- canvas.drawCircle(100, 100, 100);
- canvas.endFill();
- this.addChild(canvas);
- var textures:openfl.Vector<Texture> = assets.getTextures("img_");
- _mask = new Image( textures[1] );
- //_mask = new Quad( 528, 110, 0 );
- _mask.x = -484;
- var style:TextureMaskStyle = new TextureMaskStyle();
- mask.style = style;
- canvas.mask = mask;
- }
- public static var assets(get, never):AssetManager;
- @:noCompletion private static function get_assets():AssetManager { return sAssets; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement