type cast problem.. callfuncO_selector(CCTexture2D)

CCTextureCache::sharedTextureCache()>addImageAsync);
this
>schedule(schedule_selector(LoadingLayer::tick));

warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
error C2440: ‘type cast’ : cannot convert from ‘void (__thiscall LoadingLayer::* )(cocos2d::CCTexture2D *)’ to ‘cocos2d::SEL_CallFuncO’

i don’t know write and speak English well,
understand plz…
i know callfuncO_selector, N, ND
i want to solve… but i don’t know
how is this(‘type cast’ : cannot convert from ‘void (__thiscall LoadingLayer::* )(cocos2d::CCTexture2D *)’ to ‘cocos2d::SEL_CallFuncO’) to solve…?
i waiting for answer~
thank you


20130602_170809.png (13.8 KB)

Use void LoadingLayer::foo(cocos2d::CCObject *object) and cast object with CCTexture2D *tex = static_cast<cocos2d::CCTexture2D *>(object);

Sergey Shambir wrote:

Use void LoadingLayer::foo(cocos2d::CCObject *object) and cast object with CCTexture2D *tex = static_cast<cocos2d::CCTexture2D *>(object);

Answer about thanks!

after i debug.
i face to another problem…
i write to LoadingLayerScene.cpp

void LoadingLayer::spritesLoaded(CCObject * object)
{
CCTexture2D * tex = static_castcocos2d::CCTexture2D*(object);
}
and
debug error: cocos2d: CCSpriteFrameCache: Trying to use file sprites.png as texture

i input code of all…
you confirm my code… waiting for answer…
have a good time…

bool LoadingLayer::init()
{
bool bRet = false;
do
{
CC_BREAK_IF(! CCLayer::init());

isLoading = true;
imagesLoaded = false;

this~~>setTouchEnabled;
winSize = CCDirector::sharedDirector~~>getWinSize;
defaultImage = CCSprite::create;
defaultImage~~>setPosition);
this~~>addChild(defaultImage);

CCTextureCache::sharedTextureCache()>addImageAsync);
this
>schedule(schedule_selector(LoadingLayer::tick));

bRet = true;
} while (0);

return bRet;
}

void LoadingLayer::spritesLoaded(CCObject * object)
{
CCTexture2D * tex = static_castcocos2d::CCTexture2D*(object);
CCSpriteFrameCache::sharedSpriteFrameCache()>addSpriteFramesWithFile;
batchNode = CCSpriteBatchNode::createWithTexture;
this
>addChild(batchNode);

main_bkgrnd = CCSprite::createWithSpriteFrameName(“Turret_main_bkgrnd.png”);
main_bkgrnd~~>setPosition.height/2));
batchNode~~>addChild(main_bkgrnd);

main_title = CCSprite::createWithSpriteFrameName(“Turret_main_title.png”);
main_title~~>setPosition.height/2-MAIN_TITLE_TOP_MARGIN));
batchNode~~>addChild(main_title);

tom = CCSprite::createWithSpriteFrameName(“Tom.png”);
tom~~>setPosition.width/2, winSize.height-main_title~~>getContentSize().height/2-MAIN_TITLE_TOP_MARGIN));
batchNode~~>addChild;
CCArray * blinkAnimFrames = CCArray::createWithCapacity;
blinkAnimFrames~~>addObject(CCSpriteFrameCache::sharedSpriteFrameCache()>spriteFrameByName);
blinkAnimFrames
>addObject(CCSpriteFrameCache::sharedSpriteFrameCache()>spriteFrameByName);
blinkAnimFrames
>addObject(CCSpriteFrameCache::sharedSpriteFrameCache()>spriteFrameByName);
CCAnimation * blinkAnimation = CCAnimation::createWithSpriteFrames;
CCAnimate * blinkAnimate = CCAnimate::create;
CCFiniteTimeAction * tomSeqAct = CCSequence::create, NULL);
CCAction * rep = CCRepeatForever::createtomSeqAct);
tom
>runAction(rep);

loading = CCSprite::createWithSpriteFrameName(“Turret_loading.png”);
loading~~>setPosition.width) / 2) + tom~~>getContentSize().width,
loading~~>getContentSize.height/2 + LOADIN_BOTTOM_MARGIN));
batchNode~~>addChild(loading);

CCFiniteTimeAction * loadingSeqAct = CCSequence::create(CCFadeOut::create(1.0f), CCFadeIn::create(1.0f), NULL);
CCAction * rep2 = CCRepeatForever::create((CCActionInterval*)loadingSeqAct);
loading~~>runAction;
this~~>removeChild(defaultImage, true);
imagesLoaded = true;
}