Cocos2d iPhone - Sprite cliping/mask/frame

后端 未结 3 2091
故里飘歌
故里飘歌 2020-12-01 08:38

how can i clip/crop/mask or just set the frame of a CCSprite in Cocos2D?

Something similar to: setting the frame for UIView, with clipping subviews = TRUE

My

3条回答
  •  感动是毒
    2020-12-01 09:11

    I wrote a ClippingNode class which does exactly that. You can add other nodes (sprites, labels, etc.) to the ClippingNode and they will only be drawn in the region specified by the ClippingNode. It also takes device rotation into account.

    Internally it uses GL_SCISSOR_TEST like in Bach's answer.

    http://www.learn-cocos2d.com/2011/01/cocos2d-gem-clippingnode/

提交回复
热议问题