ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

Sprites don't show everytime #56

Open nyanev opened 12 years ago

nyanev commented 12 years ago

Hello,

I develop Android game with cocos2d. I load sprite in this way: CCSprite sprite = CCSprite.sprite(folder+"/sprite.png"); The problem is that the image sometime is loaded as white square.

makala commented 12 years ago

what's the value of folder. this must the abslote path. such as assert path.

I has use cocos2d-x now. this is the cross plateform engine, such as android, ios ... www.cocos2d-x.org

2012-02-14

makala.cn

发件人: Nikolay Yanev 发送时间: 2012-02-14 23:06:43 收件人: makala 抄送: 主题: [cocos2d] Sprites don't show everytime (#56)

Hello, I develop Android game with cocos2d. I load sprite in this way: CCSprite sprite = CCSprite.sprite(folder+"/sprite.png");

The problem is that the image sometime is loaded as white square.

Reply to this email directly or view it on GitHub: https://github.com/ZhouWeikuan/cocos2d/issues/56

nyanev commented 12 years ago

Value of the folder is "W1280" OR "W1024". This folders are located in assets dir. What is absolute path to assets?

laohu9321 commented 11 years ago

Hi

I have encountered same problem and checked the issues around this framework.

I think the reason is that you need to run add sprite in main GL thread.

So something like this; Activity.getGlSurfaceView.queueEvent(new runnable(){ @Override public void run() { addFunction(); } };

I changed the code like that, and it fixed.

Hope this works for you too.

makala commented 10 years ago

www.cocos2d-x.org

makala.cn

From: qwe460529107 Date: 2014-02-21 00:17 To: ZhouWeikuan/cocos2d Subject: Re: [cocos2d] Sprites don't show everytime (#56) Hi @laohu9321 : I use your method tries to solve the problem of texture show white, but it still can't. I tried to like this. GameActivity.getSurface().queueEvent(new Runnable() {

    @Override
    public void run() {
        // TODO Auto-generated method stub
        layer.addChild(sprite1, z);
    }
});

But still no solution. Can you give a detailed example? Thank you very much. — Reply to this email directly or view it on GitHub.

qwe460529107 commented 10 years ago

Thanks for your reply.But I don't have in the use of cocos2d-android.Now I use cocos2d-x.If I have any questions, I would request you to once again.Wish you the best of health.

------------------ 原始邮件 ------------------ 发件人: "makala"notifications@github.com; 发送时间: 2014年6月3日(星期二) 凌晨1:57 收件人: "ZhouWeikuan/cocos2d"cocos2d@noreply.github.com; 抄送: "匿名"460529107@qq.com; 主题: Re: [cocos2d] Sprites don't show everytime (#56)

www.cocos2d-x.org

makala.cn

From: qwe460529107 Date: 2014-02-21 00:17 To: ZhouWeikuan/cocos2d Subject: Re: [cocos2d] Sprites don't show everytime (#56) Hi @laohu9321 : I use your method tries to solve the problem of texture show white, but it still can't. I tried to like this. GameActivity.getSurface().queueEvent(new Runnable() {

     @Override 
     public void run() { 
         // TODO Auto-generated method stub 
         layer.addChild(sprite1, z); 
     } 
 }); 

But still no solution. Can you give a detailed example? Thank you very much. — Reply to this email directly or view it on GitHub. — Reply to this email directly or view it on GitHub.