-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnimObject.h
75 lines (71 loc) · 1.49 KB
/
AnimObject.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#include "hgeanim.h"
#ifndef ANIMOBJECT_H_
#define ANIMOBJECT_H_
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if(p){delete(p); (p)=NULL;} }
#endif
class AnimObject
{
public:
AnimObject(const char *name, int nframes, int fps, float w, float h, float centerx, float centery, int aID,bool infinite=false, float x1 = 0, float y1 = 0);
~AnimObject();
AnimObject(AnimObject *anim1,float changeFPS=0);
AnimObject(const AnimObject &obj)
{
tex = obj.tex;
anim = obj.anim;
ID = obj.ID;
imgx = obj.imgx;
imgy = obj.imgy;
dead = obj.dead;
angle = obj.angle;
size = obj.size;
alreadyplayed = false;
}
void Render(float x1, float y1,float rot=0.0f,float size=1.0f);
void UpdateStep();
void SetAngle(float newangle){ angle = newangle; };
int GetID();
void Render();
void Stop(){ anim->Stop(); };
bool Isfinish()const{ return dead; };
void ForceToDie()
{
if (!dead)
{
dead = true;
SAFE_DELETE(anim);
}
};
void ChangePos(float x1,float y1);
bool IsPlaying()const{ return anim->IsPlaying(); };
void Play(){ anim->Play(); };
bool IsInfinte()const{ return Isinfinite; };
void SetSize(float newsize)
{
size = newsize;
}
void SetColor(DWORD newcolor)
{
anim->SetColor(newcolor);
}
//void Render(float x, float y);
//bool IsMuTiAction()
//{
// if (steps == 0)
// return false;
// else return true;
//}
private:
HTEXTURE tex;
hgeAnimation *anim;
int ID;
float imgx, imgy;
bool dead;
float angle;
bool Isinfinite;
bool alreadyplayed;
float size;
};
#endif