This project is read-only.

CCClipMode.Bounds get's wrong clipping area

Topics: Layers and Transitions
Apr 29, 2014 at 11:51 AM
Hi All,

I have an issue with CCClipMode.Bounds.

When I add an image to a layer and place it at the corner of the layer and set the CCClipMode.Bounds on the layer, the image is clipped but the 'clip area' shifts on different resolutions. The 'clip area' shifts upwards in landscape when the Y-value of the CCDrawManager.VisibleOrigin is greater than 0. The shift of the 'clip area' is shifted exactly this value. The image stays on the same location on the screen, but the area that's visible shifts up.

I created a small example below just to demonstrate. I know there are other options for just a CCSprite, it's just an example. I have the same problem when I use a CCTableView.

Is it a bug? Does anyone have the same issue? Is it related to a setting?
//  imageLayer

CCLayer imageLayer = new CCLayer(CCClipMode.Bounds);

imageLayer.ContentSize = new CCSize(175f,223f);

imageLayer.Position = new CCPoint(100,100);

//  image

CCSprite image = Model.Packages.AtlasMain ["ButtonCalendarNormal"];

image.AnchorPoint = CCPoint.AnchorMiddle;

image.Position = new CCPoint(87.5f, 111.5f); // half the size of the actual image

imageLayer.AddChild(image);

this.AddChild(imageLayer);
Apr 29, 2014 at 9:28 PM
What is the resolution policy if the game?
Apr 30, 2014 at 6:56 AM
CCResolutionPolicy.NoBorder
Apr 30, 2014 at 1:32 PM
I need to make a correction: the shift upwards is always double the size of the Y-value of the VisibleOrigin

If I change the following line in the BeforeDraw Method of CClayer it works the way it should work.
CCDrawManager.SetScissorInPoints(minX, minY, maxX - minX, maxY - minY);
into
CCDrawManager.SetScissorInPoints(minX, minY-CCDrawManager.VisibleOrigin.Y*2, maxX - minX, maxY - minY);
And it's only the Y-value that messes things up.

But as far as I can see this isn't the place where it should be solved. The minX and minY are correct values, but the scissors take a wrong referencepoint for the screen.

I don't know why and I hope someone can fix it the right way.
Apr 30, 2014 at 6:08 PM
I have created a bug report for this issue on the GitHub tracker:

https://github.com/Cocos2DXNA/cocos2d-xna/issues/408