hello everybody:
i meet this question:
CGPoint a = [[CCDirector sharedDirector] convertToGL:[touch previousLocationInView:touch.view]];
CGPoint b = [[CCDirector sharedDirector] convertToGL:[touch locationInView:touch.view]];
i use c*+ instead:
so i write in this:
CCPoint a = touch~~>locationInView);
a = CCDirector::sharedDirector~~>convertToGL;
CCPoint b = touch~~>previousLocationInView);
b = CCDirector::sharedDirector~~>convertToGL;
did it right?
i find a bug in my code, when i use the prerious code , i am right,
but when i use the second code, i am wrong?
can anybody tell me?
this the entir code,
"
~~ ccTouchBegan:touch withEvent:event
{
isDragging = YES;
return TRUE;
}
~~ ccTouchMoved:touch withEvent:event
{
CGPoint a = convertToGL:];
CGPoint b = convertToGL:];
CGPoint nowPosition = ;
nowPosition.y*= ( b.y - a.y );
[scrollLayer setPosition:nowPosition];
}
~~ccTouchEnded:touch withEvent:event
{
isDragging = NO;
}
~~(void) ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event
{
}
"
and i translate it to cocos2d-x
void Social::registerWithTouchDispatcher()
{
CCTouchDispatcher::sharedDispatcher()>addTargetedDelegate;>locationInView(touch~~>view);
}
bool Social::ccTouchBegan
{
isDragging = true;
return true;
}
void Social::ccTouchEnded
{
isDragging = false;
}
void Social::ccTouchCancelled
{
}
void Social::ccTouchMoved
{
CCPoint a = touch
CCDirector::sharedDirector~~>convertToGL;
CCPoint b = touch~~>previousLocationInView);
CCDirector::sharedDirector~~>convertToGL;
CCPoint newpos = scrollLayer~~>getPosition;
newpos.y += ;
scrollLayer~~>setPosition(newpos);
}
want somebody help me.
thanks.