#include "XAnimation.h"

CXAnimation::CXAnimation(void)
{
m_strName = "";
m_nFrameCount = ;
m_fInterval = 0.0f;
} CXAnimation::~CXAnimation()
{ } CXAnimation* CXAnimation::create( const char* psName, int nBegan, int nCount, float delayPerUnit /*= 1.0*/ )
{
CXAnimation* pAnimation = new CXAnimation();
if(pAnimation->init(psName, nBegan, nCount, delayPerUnit))
{
pAnimation->autorelease();
return pAnimation;
}
else
{
SAFE_DELETE(pAnimation);
} return NULL;
} bool CXAnimation::init( const char* psName, int nBegan, int nCount, float delayPerUnit /*= 1.0*/ )
{
m_strName = psName;
m_fInterval = delayPerUnit;
m_nFrameBegan = nBegan;
m_nFrameCount = nCount; char psFrameName[] = {}; CCArray* animFrames = CCArray::create();
for (int i = nBegan; i <= nCount; i++)
{
sprintf(psFrameName,"%s%02d.png", psName, i);
CCSpriteFrame* pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(psFrameName);
ASSERT(pFrame);
if (pFrame)
{
animFrames->addObject(pFrame);
}
else
{
CCLog("Load Animation faild:%s\n", psName);
SAFE_DELETE(animFrames);
return false;
} }
this->initWithSpriteFrames(animFrames, delayPerUnit);
return true;
} float CXAnimation::getInterval()
{
return m_fInterval;
} float CXAnimation::getDuration()
{
return m_fInterval * m_nFrameCount;
} const char* CXAnimation::getAnimationName()
{
return m_strName.c_str();
} int CXAnimation::getFrameCount()
{
return m_nFrameCount;
} string CXAnimation::getFileName()
{
return m_strName;
} //CCSpriteFrame* CXAnimation::firstFrame()
//{
// return (CCSpriteFrame*)this->getFrames()->objectAtIndex(0);
//}
//
//CCSpriteFrame* CXAnimation::lastFrame()
//{
// return (CCSpriteFrame*)this->getFrames()->objectAtIndex(this->getFrameCount() - 1);
//}

最新文章

  1. QT5.1 调用https
  2. [WCF编程]12.事务:事务概述
  3. bzoj2653: middle
  4. iptables nt
  5. 数组拷贝 copyOf()
  6. Jboss消息 异常
  7. UI4_UIImageView
  8. ant脚本打jar包 自动获取时间以及项目svn版本号
  9. Win7下Boost库的安装
  10. [置顶] VB 中chr(10)、chr(13)和vblf、vbcr、vbcrlf的分别
  11. Spring+SpringMVC+MyBatis+easyUI整合基础篇
  12. bzoj 3631: [JLOI2014]松鼠的新家
  13. OpenCV——PS滤镜,毛玻璃特效
  14. python三种回收机制
  15. Loj #3055. 「HNOI2019」JOJO
  16. pandas isin
  17. laravel 配置设置
  18. Install rapyuta Robot Cloud Engine on Ubuntu14.04
  19. html table隐藏列
  20. CentOS下设置vim的tab键为4格

热门文章

  1. android NDK编程:使用posix多线程与mutex相互排斥同步
  2. Mysql5.7.9密码已过有效期的处理过程
  3. ORDER BY,GROUP BY 和DI STI NCT 优化
  4. MySQL索引优化案例
  5. 【补间动画示例】Tweened Animation
  6. [Python爬虫] 之三十一:Selenium +phantomjs 利用 pyquery抓取消费主张信息
  7. 搜索引擎爬虫蜘蛛的useragent
  8. JVM垃圾回收(GC)整理总结学习
  9. Vue组件开发实践之scopedSlot的传递
  10. XMPPFrameWork IOS 开发(三)登录