2
저는 C++과 cocos2d-x에서 초보자입니다. 그래서 왜 잘못 된 것인지 이해하지 못합니다. 코드"cocos2d :: CCPoint"를 "cocos2d :: CCPoint"로 변환 할 수 없습니다.
void
MainLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
// Get any touch and convert the touch position to in-game position.
CCTouch* touch = (CCTouch*)pTouches->anyObject();
CCPoint position = touch->locationInView();
position = CCDirector::sharedDirector()->convertToGL(position);
__pShip->setMove(position);
}
이 기능의 코드입니다.
Ship::setMove(CCPoint *newPosition)
{
__move=*newPosition;
}
당신이 그것을 매개 변수로 CCPoint 유형을 사용하여 볼 수 있지만이 위치 헤더와 함께 실패로 : 내가 잘못 뭐하는 거지
class Ship : public AnimatedObject
{
public:
Ship();
bool init(const char* frameName, CCSpriteBatchNode* pSpriteSheet);
void setMove(CCPoint* newPosition);
void move();
private:
/**
* A CCMoveTo action set in the move() method.
*/
cocos2d::CCFiniteTimeAction* __pMoveAction;
/**
* This value specifies the ship's speed.
*/
float __speed;
/**
* This value specifies position to which the ship should move.
* It's set in touch events callbacks in MainLayer class.
*/
CCPoint __move;
};
? 왜이 코드가 CCPoint 변환에 실패합니까?
정확한 오류는 어디에서 언급 할 수 있습니까? – Ajay
__pShip-> setMove (position); – Sugar
포인터 또는 참조에 문제가 있습니까? – Sugar