Hello all I am new in COCOS2DX framework and trying to develop brick breaker game. i am following this demo Brick breker game this tutorial is in cocos2d (iPhone). I code it in cocos2dx and got work correctly. but when i am implementing ccTouchesMoved method. My code compile and run properly but as i touch(click) screen it breck down and give error violation ocures. My code is
void HelloWorld::ccTouchesMoved(CCSet* touches, CCEvent* event)
{
if (_mouseJoint == NULL) return;
CCTouch *myTouch = (CCTouch*)touches->anyObject();
CCPoint location = myTouch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
_mouseJoint->SetTarget(locationWorld);
}
How can i resolve this issue. Please guide me.
in the demo that you provided, the following code initialized the mouseJoint
it is in ccTouchesBegan