When using a CCScrollView I would like to be able to limit the viewable area to a certain bounding box. How can this be achieved?
Setting the content size does not affect the viewable area.
When using a CCScrollView I would like to be able to limit the viewable area to a certain bounding box. How can this be achieved?
Setting the content size does not affect the viewable area.
So I found what seems to be a reasonable way to do this. There was some code on the cocos2d forum for clipping an area using
GL_SCISSOR
:http://forum.cocos2d-swift.org/t/cocos2d-3-1-beta-gl-scissor-test/13608/4
So I subclassed
CCScrollView
and added this method. I ended up having to tweak the coordinates a bit to get the exact right clipping area. Seems like a clunky answer so I hope someone has a better answer.