I have all my images loaded in CCSpriteFrameCache. Unfortunately CCProgressTimer class can’t use this texture.
Is there a way of doing this ?
Thanks for your feedback!
I have take a test, and it’s really not work! I think it’s a bug in both cocos2d-iphone and cocos2d-x.
The CCProgressTimer use the whole texture which the sprite used. But not the correct rect of the sprite.
So it’s not work well.
I have create an issue here: #513
Thank you once more!
Hello
can you please provide a couple of code lines to see how can I use the sprite sheet with CCProgressTimer ?
Thanks!
Adrian
I think that this problem is still present.
—
Adrian
Does anyone else have this problem ?
Thanks!
Adrian
Could you paste some demo to reproduce it?
Hello
this is a paste from my code:
@
CCParticleExplosion* emitter = CCParticleExplosion::node();
emitter~~>setTotalParticles;
emitter~~>setTexture(CCTextureCache::sharedTextureCache()->textureForKey(“stars.png”));
@
The texture is not displayed correctly.
The codes are something about particle system, no CCProgressTimer used.
Yes, you’re right. I do have problems with CCProgressTimer and CCParticleExplosion.
I and to use these two classes with CCSpriteFrameCache and it doesn’t work.
Here is the code of CCProgressTimer
m_progressBar = CCProgressTimer::progressWithTexture(
CCSpriteFrameCache::sharedSpriteFrameCache()>spriteFrameByName>getTexture);
m_progressBar~~>setType;
m_progressBar~~>setPosition(ccp(2, 2));
Where the CCProgressTimer’image is supposed to be displayed … it shows the entire texture 1024x1024.
Thans!
I am on iPhone 4.
Regards and thanks for your help!
Hi all,
why addSpriteFramesWithFile can’t use in the thread? My images were great,I must load them in thread.
*eg:
- loadResourceWithName
{
;
} - startLoadInThread
{
;
NSAutoreleasePool* pPool = init];
CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache;
cache -> addSpriteFramesWithFile);
;
;
;
}*
Hello guys
did anyone managed to use the CCProgressTimer like this:
CCProgressTimer::progressWithTexture(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(“ProgressTimer.png”)->getTexture());
Thanks!
Adrian
Hi, Adi Fly,
You can add the interface as follow to CCProgressTimer class
bool initWithSpriteFrameName(const char *pszSpriteFrameName);
static CCProgressTimer* progressWithSpriteFrameName(const char *pszSpriteFrameName);
CCProgressTimer* CCProgressTimer::progressWithSpriteFrameName(const char *pszSpriteFrameName)
{
CCProgressTimer *pProgressTimer = new CCProgressTimer();
if (pProgressTimer->initWithSpriteFrameName(pszSpriteFrameName))
{
pProgressTimer->autorelease();
}
else
{
delete pProgressTimer;
pProgressTimer = NULL;
}
return pProgressTimer;
}
bool CCProgressTimer::initWithSpriteFrameName(const char *pszSpriteFrameName)
{
m_pSprite = CCSprite::spriteWithSpriteFrameName(pszSpriteFrameName);
CC_SAFE_RETAIN(m_pSprite);
m_fPercentage = 0.f;
m_pVertexData = NULL;
m_nVertexDataCount = 0;
setAnchorPoint(ccp(0.5f, 0.5f));
setContentSize(m_pSprite->getContentSize());
m_eType = kCCProgressTimerTypeRadialCCW;
return true;
}
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("animations/grossini_family.plist");
CCProgressTimer *left = CCProgressTimer::progressWithSpriteFrameName("grossini.png");
The code above will achieve what you want.
Thank you very much!
—
Adrian
I did exactly like you said and it compiled fine, but it doesn’t show anything on the screen.
It might be a problem with my texture, let me double check.
I double checked it.
It doesn’t work. It doesn’t show the imagine.
Hi, my test demo works fine. Please download the attachment files to have a try.
Adi Fly wrote:
I double checked it.
It doesn’t work. It doesn’t show the imagine.
From what I see on your ProgressActionTest you use CCProgressTimer::progressWithFile and I want to use with SpriteFrameName.
See the line 161 of ProgressActionsTest.cpp file
CCProgressTimer *left = CCProgressTimer::progressWithSpriteFrameName(“grossinis_sister2.png”);//progressWithFile(s_pPathSister1);