-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsprite.h
57 lines (44 loc) · 1.11 KB
/
sprite.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
#ifndef SPRITE
#define SPRITE
#include "configs.h"
#include "render.h"
#include "main_loops.h"
#define IMAGE_MAX 255
class CSprite {
public:
CSprite () {
image [0] = newimage ();
width [0] = getwidth (image [0]);
height [0] = getheight (image [0]);
index = 0;
}
CSprite (PIMAGE p) {
image [0] = p;
width [0] = getwidth (image [0]);
height [0] = getheight (image [0]);
index = 0;
}
CSprite (string path) {
image [0] = newimage ();
get_image (path);
width [0] = getwidth (image [0]);
height [0] = getheight (image [0]);
index = 0;
}
PIMAGE image [IMAGE_MAX];
double width [IMAGE_MAX], height [IMAGE_MAX];
int index;
void next () {
index ++;
}
void switch_index (int x) {
index = x;
}
void get_image (string path, int index = 0) {
getimage (image [index], path. data ());
}
void put_image (double x, double y, double angle, double zoom, PIMAGE target = NULL) {
pRender -> Sprite (image [index], x, y, width [index], height [index], zoom, angle, target);
}
};
#endif