Sprites don't show everytime
Opened this issue · 5 comments
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.
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
Value of the folder is "W1280" OR "W1024". This folders are located in assets dir. What is absolute path to assets?
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.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.
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)
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.