-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.cpp
More file actions
88 lines (44 loc) · 1.05 KB
/
Copy pathimage.cpp
File metadata and controls
88 lines (44 loc) · 1.05 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "image.h"
#include <iostream>
using namespace std;
void IMAGE::load(char* path) {
bitmap = load_bitmap(path, desktop_pallete);
speed = 5;
count = 0;
wspeed = bitmap->w / speed;
hspeed = bitmap->h / speed;
pivot_x = bitmap->w / 2;
pivot_y = bitmap->h / 2;
return;
}
void IMAGE::hide() {
if (visible && count == 0) {
visible = false;
count = speed;
}
return;
}
void IMAGE::show() {
if (visible == false && count == 0) {
visible = true;
count = speed;
}
return;
}
void IMAGE::draw(BITMAP* target, int x, int y, float angle) {
// Something executed show() or hide() recently
if (count != 0) {
int ws = count * wspeed;
int hs = count * hspeed;
count--;
if (!visible) {
ws = ((speed - 1) * wspeed) - ws;
hs = ((speed - 1) * hspeed) - hs;
}
pivot_scaled_sprite(target, bitmap, x, y, pivot_x, pivot_y, ftofix(angle), ftofix((float)hs / (float)bitmap->h));
return;
}
if (visible)
pivot_sprite(target, bitmap, x, y, pivot_x, pivot_y, ftofix(angle));
return;
}