Cocos2DXNA / cocos2d-xna

XNA Port of Cocos2d-X
www.cocos2dxna.com
227 stars 123 forks source link

Unexpected offset on iOS using clipping node #408

Open totallyeviljake opened 10 years ago

totallyeviljake commented 10 years ago

Seen here: https://cocos2dxna.codeplex.com/discussions/543703

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);