How to use CCMask?


#1

Hi,
I’m new with the Cocos2d-x framework and not fluent in C*+ yet, so far I’ve been finding the Lua binding a quite smooth entrance to the framework to start with. But to approach CCMask I understand I might need to stick with C**. I’ve been reading all I can about the CCMask class that I’ve come across. I’ve tried to approach it with pure C*+ but my knowledge is limited.

Testing with version 2.1beta3 and 2.0rc2 of Cocos2d-x.
If I try to use the CCMask class, XCode says CCMask in Cocos2D it doesn’t exsist / undeclared, so I try to integrate it myself by creating the CCMask.h and CCMask.cpp files in the Classes folder but then it tells me that I’m redeclaring it and it already exsists.

CCMask.cpp: http://www.cocos2d-x.org/attachments/992/CCMask.cpp
CCMask.h: http://www.cocos2d-x.org/attachments/991/CCMask.h

Is CCMask integrated yet? If so, a basic C++ example of creating a sprite and masking it would be greatly appreciated. Even better if possible with Lua.


#2

You should add

#ifndef  xxxxxx
#define xxxxxx

at the begin of header file, and

#endif // xxxxxx

at the end of header file.