Open kjpou1 opened 9 years ago
This is also no longer working on Windows.
Issue reported here https://github.com/mono/MonoGame/issues/3943
It's not working indeed.
I made a little test, inspired by the code there http://stackoverflow.com/a/18736230/509981 to make a part of a layer transparent.
Size visibleSize = Director::getInstance()->getVisibleSize();
Point origin = Director::getInstance()->getVisibleOrigin();
addChild(LayerColor::create(Color4B(122, 144, 0, 255), visibleSize.width, visibleSize.height));
//this is the layer that we want to "cut"
Layer *layer = Layer::create();
Sprite* pSprite = Sprite::create("ball.png");
pSprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
layer->addChild(pSprite, 0);
//we need to create a ccnode, which will be a stencil for ccclipingnode, draw node is a good choice for that
DrawNode * stencil = DrawNode::create();
stencil->drawSegment(Vec2(0, 0), Vec2(visibleSize.width, visibleSize.height), 20, Color4F(0, 0, 0, 255));
//CCClipingNode show the intersection of stencil and theirs children
ClippingNode *cliper = ClippingNode::create(stencil);
//you want to hide intersection so we setInverted to true
cliper->setInverted(true);
cliper->addChild(layer);
addChild(cliper);
this.AddChild(new CCLayerColor(new CCSize(1024,768),new CCColor4B(122,144,0,255)));
//this is the layer that we want to "cut"
CCLayer layer = new CCLayer();
CCSprite pSprite = new CCSprite("ball.png");
pSprite.Position = new CCPoint(512, 386);
layer.AddChild(pSprite);
CCDrawNode stencil = new CCDrawNode();
stencil.DrawSolidCircle(new CCPoint(0, 0), 20, new CCColor4B(0, 0, 0, 255));
stencil.DrawLine(new CCPoint(0,0),new CCPoint(1024, 768),20,new CCColor4B(0, 0, 0, 255));
CCClippingNode cliper = new CCClippingNode(stencil);
cliper.Inverted = true;
cliper.AddChild(layer);
this.AddChild(cliper);
What worries me the most is that it's a more than a year old bug and it's still not fixed...
Hey Guys. I'm on version 1.7.1 (latest as of today) and the CCClippingNode class is still not working. Any news on this? Maybe a workaround?
This is the answer I got from miguel de icaza few months ago https://twitter.com/juliengomes/status/786905026757263360
CocosSharp seems to be down but FlatRedBall is a good alternative for 2D cross-platform game dev using C# (also based on MonoGame): www.flatredball.com
Hope that helps.
--Victor Chelaru-- 801 391 5271 hangouts: VicChelaru@gmail.com skype: armysarj www.flatredball.com
On Sun, Jul 9, 2017 at 8:35 AM, Julien Gomès notifications@github.com wrote:
This is the answer I got from miguel de icaza few months ago https://twitter.com/juliengomes/status/786905026757263360
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mono/CocosSharp/issues/97#issuecomment-313923662, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsiH8io9tqP4W9-C3VGsBB1LDKljY4oks5sMOVPgaJpZM4DRCTc .
This has never worked on iOS or Mac because of missing functionality from the MonoGame side of things. If the functionality is there then it is not working correctly nor the same as for windows.
Reference http://forums.xamarin.com/discussion/30693/cant-get-ccclippingnode-to-work-has-anyone#latest