我有一个CCScrollLayer,我想在它里面设置多个CCLayer来来回滑动页面。一些内容会在页面CCLayer上展开并进入下一页,因此在滑动时,您可以看到前一页中的内容推入下一页。我想要实现的是类似于UIView函数,它裁剪到边界,在那里您将看不到层的contentSize之外的任何东西。有人知道该怎么做吗?我希望页面的大小是设备屏幕的大小。我试过这样做,但没有得到想要的结果:
kmGLPushMatrix();
glEnable(GL_SCISSOR_TEST);
CGPoint startingPoint = ccp(0,0);
glScissor(0,0,[UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height);
glDisable(GL_SCISSOR_TEST);
kmGLPopMatrix(); 任何帮助都是很棒的!
发布于 2013-12-12 07:44:38
你有没有看过CCClippingNode (cocos2d版本的2.+) ...在访问方法中访问以获得一些灵感。这里,来自文档:
/** CCClippingNode is a subclass of CCNode.
It draws its content (childs) clipped using a stencil.
The stencil is an other CCNode that will not be drawn.
The clipping is done using the alpha part of the stencil (adjusted with an alphaThreshold).
*/https://stackoverflow.com/questions/20515093
复制相似问题