Hi, I'm wondering if anyone can help me with this... basically I've got a sprite that I want to reveal by using a mask that get's updated upon certain actions in the game.
So I'm using a CCDrawNode for the CCClippingNode stencil and a sprite for the content. No matter what I do the whole sprite gets drawn. Here's some example code which should only reveal a small rectangular area of the full image:
CCSprite fullImage = new CCSprite("myphoto"); CCDrawNode revealMask = new CCDrawNode(); revealMask.DrawRect(new CCRect(100.0F, 100.0F, 300.0F, 200.0F), CCColor4B.White); CCClippingNode revealedImage = new CCClippingNode(); revealedImage.ContentSize = ActualBackground.ContentSize; revealedImage.AnchorPoint = new CCPoint(0.5f, 0.5f); revealedImage.Stencil = revealMask; revealedImage.AddChild(fullImage); backgroundLayer.AddChild(revealedImage);
I have also tried setting the CCClippingNode alpha threshold to 0.0 as this is what some COCOS2D examples use and this has no effect.
I then tried downloading the CocosSharp source code from GitHub and compiled and ran the suite of tests that is included with it and I have to say that I don't think that the CCClippingNode tests are working - these don't seem to be clipping either. Is something broken in CocosSharp.
I've tried using both the 1.2 and the newly updated 1.3 versions. I'm running on iOS using the simulator if that makes any difference.
Any help will be gratefully appreciated,