1 #include "DAnimation.h"
5 anim_t::anim_t( unsigned int _start
, unsigned int _length
, unsigned int _delay
, bool _loop
)
13 DAnimation::DAnimation( Tileset
*set
)
19 DAnimation::~DAnimation() {}
21 void DAnimation::Reset()
28 void DAnimation::load( anim_t
*anim
)
30 if( this->anim
== anim
)
37 void DAnimation::Draw( Sint16 X
, Sint16 Y
)
41 if( anim
->length
== 0 )
43 set
->Draw( X
, Y
, anim
->start
);
47 if( ++framescount
>= anim
->delay
)
49 framescount
-= anim
->delay
;
53 pos
= (pos
+1) % (anim
->length
);
56 if( pos
< anim
->length
)
60 set
->Draw( X
, Y
, anim
->start
+ pos
);
65 bool DAnimation::finished()
67 if(!anim
) return true;
68 if(anim
->loop
) return false;
69 if(pos
<anim
->length
) return false;