Hello,
I trying to create kind of freehand drawing application (Win8). So, I was thinking to use CCRenderTexture for that. For some reason, it doen’t works. The texture remains clean, without any sign of my drawing. Here is what i trying to do:
bool TestLayer::init()
{
CCLayerColor::initWithColor( ccc4f(255,255,255,255) );
this~~>setIsTouchEnabled;
//test
CCSize size = CCDirector::sharedDirector~~>getWinSize;
target = CCRenderTexture::renderTextureWithWidthAndHeight;
target~~>retain;
target~~>setPosition(ccp(size.width / 2, size.height / 2));
this~~>addChild;
brush = CCSprite::spriteWithFile; //just some 64x64 round image
ccColor3B color;
color.b = 255;
color.r = 0;
color.r = 0;
brush~~>setColor(color);
brush~~>retain;
return true;
}
void TestLayer::ccTouchMoved
{
CCSize size = CCDirector::sharedDirector~~>getWinSize;
CCPoint startTouch = pTouch~~>locationInView;
CCPoint start ;
CCPoint endTouch = pTouch~~>previousLocationInView();
CCPoint end (endTouch.x, size.height - endTouch.y);
target~~>begin;
brush~~>setPosition(ccp(100,100));
brush~~>visit;
target~~>end();
}
I really stuck on this, and I appreciate any help.
Thank you!