Class Ambiguity Error(ambigious conversion from drived class) With CCStandredTouchDelegate in cocos2dx?

143 Views Asked by At

I am Subclassing a CCSprite, in order to make Rotation Gesture for a sprite object.

For this purpose i need to use CCTargetedTouchDelegate and CCStandardTouchDelegate But even after declaring functions of those delegates i am getting an ambiguity error.

The Error Screen Shot :-

enter image description here

code in my .h file.

namespace mygames
{

class DragSprite: public cocos2d::CCSprite, public cocos2d::CCTargetedTouchDelegate, public cocos2d::CCStandardTouchDelegate
{
    public:
        cocos2d::CCSize canvasSize;
        bool init();
        static DragSprite* createWithFile(const char *pszFileName);
        bool isTouchingOnSprite(cocos2d::CCPoint  touch);

        virtual bool ccTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent);
        virtual void ccTouchMoved(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent);
        virtual void ccTouchEnded(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent);

    virtual void ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent) ;
    virtual void ccTouchesMoved(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent) ;
    virtual void ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent) ;
    virtual void ccTouchesCancelled(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent) ;

        float angleBetweenLineInDegrees(cocos2d::CCPoint startLineA,cocos2d::CCPoint endLineA,cocos2d::CCPoint startLineB,cocos2d::CCPoint endLineB);

    ~DragSprite();
     CREATE_FUNC(DragSprite);
    private :
        bool isDrag;
        bool isPinch;
        bool canRotate;
        cocos2d::CCPoint whereTouch;
        cocos2d::CCPoint midPoint;
        int touchNumber;
        float lastDistance;
        float distance;
        float lastAngle;
        float angle;
        float cumulatedAngle;
        float spriteAngle;
        float innerRadious;
        float outerRadious;
        cocos2d::CCArray * touches;
        cocos2d::CCTouch *firstTouch;
        cocos2d::CCTouch *secondTouch;
        float touchDistanceLast;
        float touchDistanceNow;

};
}

error related code in my .cpp file

DragSprite* DragSprite::createWithFile(const char *pszFileName)
{
DragSprite *pSprite = new DragSprite();
if (pSprite&&pSprite->initWithFile(pszFileName))
{
    cocos2d::CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(pSprite, 0, true);
    cocos2d::CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(pSprite, 0);
    pSprite->setAnchorPoint(ccp(0.5, 0.5));

    pSprite->autorelease();
    return pSprite;
}
CC_SAFE_DELETE(pSprite);
return NULL;
}


bool DragSprite::ccTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{
//some code.....

return false/true;
}

void DragSprite::ccTouchMoved(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{

//Some Code....

}

void DragSprite::ccTouchEnded(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{
//Some Code....
}


void DragSprite::ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
{
CCLOG("TSB");
}


void DragSprite::ccTouchesMoved(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
{
CCLOG("TSM");
}


void DragSprite::ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
{
CCLOG("TSE");
}


void DragSprite::ccTouchesCancelled(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
{
CCLOG("TSC");
}
0

There are 0 best solutions below