Hello,
I try to use a mask in Starling 2 but is not working
Actual result :
Expected result :
my project :
Thanks
Hello,
I try to use a mask in Starling 2 but is not working
Actual result :
Expected result :
my project :
Thanks
I will try and take a look
I think I have your code building, but I don’t have the same image. Would you mind sharing the image you are using as your first texture, and where/how it is named? Thanks
image name : “rect_red.png” (for the mask)
Okay, I have it compiling. Thank you for your help
If anyone wants to test this, here’s a basic Startup
class that works with the above MainClass
(so long as you change it from textures[1]
to textures[0]
)
package;
import openfl.display.Sprite;
import openfl.utils.Assets;
import starling.core.Starling;
import starling.events.Event;
import starling.textures.Texture;
import starling.utils.AssetManager;
class Startup extends Sprite {
private var starling:Starling;
public function new () {
super ();
starling = new Starling (Game, stage);
starling.addEventListener (Event.ROOT_CREATED, function () {
var assets = new AssetManager ();
assets.addTexture ("img_rect_red", Texture.fromBitmapData (Assets.getBitmapData ("assets/img_rect_red.png")));
var game:Game = cast starling.root;
game.start (assets);
});
starling.start ();
}
}
You’re right, the mask appears to crop properly (as a texture) on the Flash target, but not on the other targets. This will require a deeper dive into the rendering code
sorry, img_rect is in spritesheet (textures[1])