关于载入资源进度条的做法~~~~~~~~求助

如何搞啊?这个是我一直想问的如何做到显示那种加载了百分之多少

cocos2d-x 里面封装CCProgressTimer类,直接一个方法就能得到加载了百分之几

— Begin quote from ____

andyque 发表于 2012-4-9 13:16 url

— End quote

昨天看了下test里面的textruecache test 可以搞了差不多。。

— Begin quote from ____

andyque 发表于 2012-4-7 21:43 url

参考这个链接: http://www.cocos2d-iphone.org/forum/topic/363

— End quote

如何做显示资源载入进度条还要显示百分比,以前没做过,以前就是直接卡死一个loading画面然后切换到新的scene

— Begin quote from ____

kineting 发表于 2012-4-9 11:46 url

如何做显示资源载入进度条还要显示百分比,以前没做过,以前就是直接卡死一个loading画面然后切换到新的s …

— End quote

@interface loadingscene : CCScene {

        CCLabelTTF *label;
        CCSprite *loadingbar, *frame;
        int count;
}
+(id) scene;
@end



@implementation loadingscene
+(id) scene
{
        CCScene *scene=;
        loadingscene *layer=;
        ;
        return scene;
}

-(id) init
{
        if((self=))
        {
                count=0;
                
                label=; 
                label.position=ccp(240,160);
                ;
                
                loadingbar=;
                loadingbar.anchorPoint=CGPointZero;
                loadingbar.scaleX=0;
                ;
                
                frame=;
                frame.anchorPoint=CGPointZero;
                ;
                
                
                ;
                
        }
        return self;
}

-(void) update:(ccTime) delta
{
         preloadEffect:@"Machine2.caf"];
        
        loadingbar.scaleX+=0.01f; //please ignore this. Its just a simulation.
        if(loadingbar.scaleX >= 1)
        {
                 replaceScene:];
        }
        
}

参考这个链接: http://www.cocos2d-iphone.org/forum/topic/363

我是用pthread另开一个线程,再用setTextureRect设置显示区域实现的!

cocos2d-x不是线程安全的把? cocos2d里有一个帖子推荐将加载步骤分成几步,然后通过schedule调用