3

这里的代码:

CCTouch* touch = (CCTouch*)( touches->anyObject() );
CCPoint location = touch->locationInView(touch->view());

怎么了?

编辑:

我认为这里要问的是:

为什么以下代码在 cocos2d-x 的新 cocos2d-1.0.1-x-0.13.0-beta 版本中中断,而在 cocos2d-1.0.1-x-0.12.0 中运行良好?

CCTouch* touch = (CCTouch*)( touches->anyObject() );
CCPoint location = touch->locationInView(touch->view());

答案是 locationInView() 方法不再需要参数。正确的代码是:

CCTouch* touch = (CCTouch*)( touches->anyObject() );
CCPoint location = touch->locationInView();
4

0 回答 0