forked from Breeze-del/C-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Resource.cpp
241 lines (234 loc) · 8.97 KB
/
Resource.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
// Resource.cpp: implementation of the CResource class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Resource.h"
#include "stdio.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IplImage* CResource::m_peashooter[4] =
{
cvLoadImage(".\\img\\model\\豌豆射手\\0.png"),
cvLoadImage(".\\img\\model\\豌豆射手\\1.png"),
cvLoadImage(".\\img\\model\\豌豆射手\\2.png"),
cvLoadImage(".\\img\\model\\豌豆射手\\3.png")
};
IplImage* CResource::m_sunflower[3] =
{
cvLoadImage(".\\img\\model\\向日葵\\0.png"),
cvLoadImage(".\\img\\model\\向日葵\\1.png"),
cvLoadImage(".\\img\\model\\向日葵\\2.png")
};
IplImage* CResource::m_iceshooter[3] =
{
cvLoadImage(".\\img\\model\\寒冰射手\\0.png"),
cvLoadImage(".\\img\\model\\寒冰射手\\1.png"),
cvLoadImage(".\\img\\model\\寒冰射手\\2.png")
};
IplImage* CResource::m_pumpkin[4] =
{
cvLoadImage(".\\img\\model\\窝瓜\\0.png"),
cvLoadImage(".\\img\\model\\窝瓜\\1.png"),
cvLoadImage(".\\img\\model\\窝瓜\\2.png"),
cvLoadImage(".\\img\\model\\窝瓜\\3.png")
};
IplImage* CResource::m_pumpkin_attack[4] =
{
cvLoadImage(".\\img\\model\\窝瓜\\attack\\1.jpg"),
cvLoadImage(".\\img\\model\\窝瓜\\attack\\2.jpg"),
cvLoadImage(".\\img\\model\\窝瓜\\attack\\3.jpg"),
cvLoadImage(".\\img\\model\\窝瓜\\attack\\4.jpg")
};
IplImage* CResource::m_nut[4] =
{
cvLoadImage(".\\img\\model\\坚果\\0.png"),
cvLoadImage(".\\img\\model\\坚果\\1.png"),
cvLoadImage(".\\img\\model\\坚果\\2.png"),
cvLoadImage(".\\img\\model\\坚果\\3.png")
};
IplImage* CResource::m_cherrybomb[6] =
{
cvLoadImage(".\\img\\model\\樱桃炸弹\\0.png"),
cvLoadImage(".\\img\\model\\樱桃炸弹\\1.png"),
cvLoadImage(".\\img\\model\\樱桃炸弹\\2.png"),
cvLoadImage(".\\img\\model\\樱桃炸弹\\3.png"),
cvLoadImage(".\\img\\model\\樱桃炸弹\\4.png"),
cvLoadImage(".\\img\\model\\樱桃炸弹\\5.png")
};
IplImage* CResource::m_hatZom_move[11] =
{
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\1.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\2.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\3.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\4.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\5.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\6.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\7.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\8.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\9.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\10.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\move\\11.jpg")
};
IplImage* CResource::m_hatZom_attack[6] =
{
cvLoadImage(".\\img\\model\\帽子僵尸\\attack\\1.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\attack\\2.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\attack\\3.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\attack\\4.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\attack\\5.jpg"),
cvLoadImage(".\\img\\model\\帽子僵尸\\attack\\6.jpg")
};
IplImage* CResource::m_normalZom_move[6] =
{
cvLoadImage(".\\img\\model\\普通僵尸\\move\\1.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\move\\2.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\move\\3.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\move\\4.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\move\\5.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\move\\6.jpg")
};
IplImage* CResource::m_normalZom_attack[6] =
{
cvLoadImage(".\\img\\model\\普通僵尸\\attack\\1.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\attack\\2.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\attack\\3.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\attack\\4.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\attack\\5.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\attack\\6.jpg")
};
IplImage* CResource::m_normalZom_bomb[10] =
{
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\1.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\2.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\3.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\4.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\5.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\6.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\7.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\8.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\9.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\bomb\\10.jpg")
};
IplImage* CResource::m_normalZom_dead[7] =
{
cvLoadImage(".\\img\\model\\普通僵尸\\dead\\body\\1.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\dead\\body\\2.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\dead\\body\\3.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\dead\\body\\4.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\dead\\body\\5.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\dead\\body\\6.jpg"),
cvLoadImage(".\\img\\model\\普通僵尸\\dead\\body\\7.jpg")
};
IplImage* CResource::m_doorZom_move[9] =
{
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\1.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\2.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\3.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\4.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\5.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\6.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\7.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\8.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\move\\9.jpg")
};
IplImage* CResource::m_doorZom_attack[6] =
{
cvLoadImage(".\\img\\model\\铁门僵尸\\attack\\1.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\attack\\2.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\attack\\3.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\attack\\4.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\attack\\5.jpg"),
cvLoadImage(".\\img\\model\\铁门僵尸\\attack\\6.jpg")
};
IplImage* CResource::m_drumZom_move[6] =
{
cvLoadImage(".\\img\\model\\铁桶僵尸\\move\\1.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\move\\2.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\move\\3.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\move\\4.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\move\\5.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\move\\6.jpg")
};
IplImage* CResource::m_drumlZom_attack[6] =
{
cvLoadImage(".\\img\\model\\铁桶僵尸\\attack\\1.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\attack\\2.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\attack\\3.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\attack\\4.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\attack\\5.jpg"),
cvLoadImage(".\\img\\model\\铁桶僵尸\\attack\\6.jpg")
};
IplImage* CResource::m_cards[7] =
{
cvLoadImage(".\\img\\card\\寒冰射手_卡.png"),
cvLoadImage(".\\img\\card\\坚果_卡.png"),
cvLoadImage(".\\img\\card\\豌豆射手_卡.png"),
cvLoadImage(".\\img\\card\\窝瓜_卡.png"),
cvLoadImage(".\\img\\card\\向日葵_卡.png"),
cvLoadImage(".\\img\\card\\樱桃炸弹_卡.png"),
cvLoadImage(".\\img\\card\\食人花_卡.png")
};
IplImage* CResource::m_bg = cvLoadImage(".\\img\\bg\\GameBg.png");
IplImage* CResource::m_ball = cvLoadImage(".\\img\\model\\ball.png");
IplImage* CResource::m_iceball = cvLoadImage(".\\img\\model\\iceball.png");
IplImage* CResource::m_sun = cvLoadImage(".\\img\\model\\sun.png");
IplImage* CResource::m_scoop = cvLoadImage(".\\img\\model\\铲子.png");
IplImage* CResource::m_peashooter_write = cvLoadImage(".\\img\\model\\豌豆射手\\白.png");
IplImage* CResource::m_sunflower_write = cvLoadImage(".\\img\\model\\向日葵\\白.png");
IplImage* CResource::m_iceshooter_write = cvLoadImage(".\\img\\model\\寒冰射手\\白.png");
IplImage* CResource::m_pumpkin_write = cvLoadImage(".\\img\\model\\窝瓜\\白.png");
IplImage* CResource::m_nut_write = cvLoadImage(".\\img\\model\\坚果\\白.png");
IplImage* CResource::m_cherrybomb_write = cvLoadImage(".\\img\\model\\樱桃炸弹\\白.png");
IplImage* CResource::m_startimg = cvLoadImage(".\\img\\bg\\Start.png");
IplImage* CResource::m_endimg = cvLoadImage(".\\img\\bg\\end.png");
IplImage* CResource::m_warning = cvLoadImage(".\\img\\bg\\warning.png");
IplImage* CResource::m_prepare = cvLoadImage(".\\img\\bg\\prepare.png");
CResource::CResource()
{
}
CResource::~CResource()
{
cvReleaseImage(&m_ball);
cvReleaseImage(&m_iceball);
cvReleaseImage(&m_sun);
cvReleaseImage(&m_bg);
cvReleaseImage(&m_scoop);
cvReleaseImage(&m_peashooter_write);
cvReleaseImage(&m_sunflower_write);
cvReleaseImage(&m_iceshooter_write);
cvReleaseImage(&m_pumpkin_write);
cvReleaseImage(&m_nut_write);
cvReleaseImage(&m_cherrybomb_write);
cvReleaseImage(&m_startimg);
cvReleaseImage(&m_endimg);
Clear(m_cards, 6);
Clear(m_peashooter, 4);
Clear(m_sunflower, 3);
Clear(m_iceshooter, 3);
Clear(m_pumpkin, 4);
Clear(m_pumpkin_attack, 4);
Clear(m_nut, 4);
Clear(m_cherrybomb, 6);
Clear(m_hatZom_move, 11);
Clear(m_hatZom_attack, 6);
Clear(m_doorZom_move, 9);
Clear(m_doorZom_attack, 6);
Clear(m_drumZom_move, 6);
Clear(m_drumlZom_attack, 6);
Clear(m_normalZom_move, 6);
Clear(m_normalZom_dead, 7);
Clear(m_normalZom_attack, 6);
Clear(m_normalZom_bomb, 10);
}
void CResource::LoadImg(IplImage *in[], vector <IplImage* >& out, int num) {
for (int i = 0; i < num; i++) {
out.push_back(in[i]);
}
}
void CResource::Clear(IplImage *img[], int num)
{
for (int i = 0; i < num; i++) {
cvReleaseImage(&img[i]);
}
}