0

我有一个旧代码。我将它移植到新的 Cocos2d-x rc0 2.1.3 。它在以下几行中给了我错误:

1.在GameScene.cpp中

CCScene *scene = CCScene::node();
GameScene *layer = GameScene::node();

2.在GameScene.cpp中

userPaddle_->runAction(CCMoveTo::actionWithDuration(0.3 * diffX / gameArea_.size.width, destPosition));

3.在GameScene.cpp中

CCPoint location = touch->locationInView(touch->view());

4.在GameScene.cpp中

if (CCRect::CCRectContainsPoint(touchArea_, location))

5.在GameScene.cpp中

if (CCRect::CCRectIntersectsRect(ballRect, CC_SPRITE_RECT(paddle)))

6. 在 Appdelegate.cpp

pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());

7. 在 GameScene.h 中

// implement the "static node()" method manually
LAYER_NODE_FUNC(HelloWorld);
4

1 回答 1

0

cocos2d-x API 变更的完整列表,请参考

http://www.cocos2d-x.org/projects/cocos2d-x/wiki/API_Change_List_from_v1x_to_2x

http://www.cocos2d-x.org/projects/cocos2d-x/wiki/About_Static_Constructor_API_changes_in_cocos2d-x_v20

node()->create()

actionWithDuation(a,b)->create(a,b)

CCRect::CCRectContainsPoint(touchArea_, location)->touchArea_.containsPoint(location)

touch->locationInView(touch->view())->touch->getLocation()

CCRect::CCRectIntersectsRect(ballRect, CC_SPRITE_RECT(paddle))- >ballRect.intersectsRect(CC_SPRITE_RECT(paddle))

LAYER_NODE_FUNC->CREATE_FUNC如果仍然存在。

我忘记了 OpenGLView 之一,但有一个。

于 2013-08-01T05:28:11.253 回答