首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在父cclayer内剪裁多个cclayer

在父cclayer内剪裁多个cclayer
EN

Stack Overflow用户
提问于 2013-12-11 17:18:54
回答 1查看 105关注 0票数 0

我有一个CCScrollLayer,我想在它里面设置多个CCLayer来来回滑动页面。一些内容会在页面CCLayer上展开并进入下一页,因此在滑动时,您可以看到前一页中的内容推入下一页。我想要实现的是类似于UIView函数,它裁剪到边界,在那里您将看不到层的contentSize之外的任何东西。有人知道该怎么做吗?我希望页面的大小是设备屏幕的大小。我试过这样做,但没有得到想要的结果:

代码语言:javascript
复制
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(); 

任何帮助都是很棒的!

EN

回答 1

Stack Overflow用户

发布于 2013-12-12 07:44:38

你有没有看过CCClippingNode (cocos2d版本的2.+) ...在访问方法中访问以获得一些灵感。这里,来自文档:

代码语言:javascript
复制
/** 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).
*/
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20515093

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档