.h
#include "cocos2d.h"
#include "cocos-ext.h"
#include "ui/CocosGUI.h"
#include "cocostudio/CocoStudio.h"
USING_NS_CC;
USING_NS_CC_EXT;
using namespace ui;
RenderTexture* _target;
Vector<Sprite*> _brushs;
void onTouchesMoved(const std::vector<Touch*>& touches, Event* event);
void saveImage(cocos2d::Ref *sender);
void clearImage(cocos2d::Ref *sender);
.cpp
Size widgetSize = Director::getInstance()->getWinSize();
layout = Layout::create();
layout->setSize(Size(widgetSize.width, widgetSize.height));
//横向排列,这里类似Android里的线性布局
//layout->setLayoutType(LAYOUT_RELATIVE);
/*以图片为背景*/
layout->setBackGround