SpriteAnimation* SpriteAnimation::create(const std::string& plist, float delay)
{
    SpriteAnimation* ret = new SpriteAnimation();
    if (ret && ret->init(plist, delay))
    {
        ret->autorelease();
        return ret;
    }
    else
    {
        delete ret;
        return nullptr;
    }
}
Esempio n. 2
0
SpriteAnimation* SpriteAnimation::create(const char* plist, bool repeat)
{
    SpriteAnimation *pRet = new SpriteAnimation();
    if (pRet && pRet->init(plist, repeat))
    {
        pRet->autorelease();
        return pRet;
    }
    else
    {
        delete pRet;
        pRet = NULL;
        return NULL;
    }
}
Esempio n. 3
0
void GameObject::processSpriteAnimation(int state, float time, int startCol, int startRow, int endCol, int endRow, int repeatCount, bool oppDir)
{
	//SpriteAnimation *sa;
	//sa = dynamic_cast<SpriteAnimation*>(MeshBuilder::GenerateSpriteAnimation(name, numRow, numCol, 1.f));
	//sa->textureID[0] = LoadTGA(texture_path);
	SpriteAnimation *temp;
	temp = generateSpriteMesh();
	if(temp->name == "" || temp->textureID[0] == 0)
	{
		cout << "Sprite empty" << endl;
		delete temp;
		return;
	}
	temp->init(time, startCol, startRow, endCol, endRow, repeatCount, oppDir);
	animationList[state] = temp;
}