Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprites don't show everytime #56

Open
nyanev opened this issue Feb 14, 2012 · 5 comments
Open

Sprites don't show everytime #56

nyanev opened this issue Feb 14, 2012 · 5 comments

Comments

@nyanev
Copy link

nyanev commented Feb 14, 2012

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
Copy link
Collaborator

makala commented Feb 14, 2012

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:
#56

@nyanev
Copy link
Author

nyanev commented Feb 14, 2012

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

@laohu9321
Copy link

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
Copy link
Collaborator

makala commented Jun 2, 2014

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants