Here https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.h and https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.cpp you can see how a Sprite is being rendering in RenderTexture. What I want to add to this to make visible only the specific part in RenderTexture (canvas). I.e. I should apply a free form mask on it to be able to draw in a specific free form area.
Good application of this is when player colors nails of a character or coloring other parts.
How to do this in cocos2d-x 3.2?
i think clipping node can help you. check out this link,
This tutorial is about how to create the new scene or layer transition which I called “Triangle Shape Cut Triansition”. You must have seen it in some popular games. Let’s begin.
The project is build on cocos2dx3.0. You can download the code in the attached files.
I supposed you have known how to create a new project in cocos2dx3.0.
Use Visual studio IDE to open the win32 project, the new project has 2 class ,AppDelegate and HelloWorldScene.
Create a new class GameScene.(Make sure the new …
@smitpatel88 thank you. So I create an object with DrawNode and setStencil
that object to the ClippingNode. Nice and easy. Only problem is that it can be an image of a hand, and I need to color only nails. So I need to create 5 shapes with DrawNode to cover the nails. Not very handy, huh?
iQD
October 12, 2014, 9:27pm
#4
Why 5 shapes? Just paint the nails into a sprite and use it as a stencil.