-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCAnimationAdvance.cpp
45 lines (40 loc) · 991 Bytes
/
CAnimationAdvance.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "stdafx.h"
#include "Resource.h"
#include <mmsystem.h>
#include <ddraw.h>
#include "gamelib.h"
#include "CAnimationAdvance.h"
namespace game_framework
{
CAnimationAdvance::CAnimationAdvance(){
animation=NULL;
}
CMovingBitmap* CAnimationAdvance::GetBitmap(){
return &(*bmp_iter);
}
void CAnimationAdvance::SetAnimation(CAnimation *animation){
this->animation=animation;
animation->Reset();
bmp_iter=animation->GetCurrentBitmapIter();
delay_counter = animation->DelayCount();
}
void CAnimationAdvance::OnMove(){
if (--delay_counter <= 0) {
delay_counter = animation->DelayCount();
bmp_iter++;
animation->SetCurrentBitmapIter(bmp_iter);
if(animation->IsFinalBitmap()){
animation->Reset();
bmp_iter=animation->GetCurrentBitmapIter();
}
}
}
void CAnimationAdvance::SetTopLeft(int x,int y){
animation->SetTopLeft(x,y);
}
void CAnimationAdvance::OnShow()
{
animation->SetCurrentBitmapIter(bmp_iter);
animation->OnShow();
}
}