-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSprites.h
272 lines (213 loc) · 5.83 KB
/
Sprites.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
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
#pragma once
#include <QRect>
#include <QPixmap>
#include <QBitmap>
#include <iostream>
#include <string>
#include <QPainter>
#include <thread>
#include "Animator.h"
namespace TexManager {
/** Elements must be caps */
enum TexID {
// Kirby base movements
KIRBY_STAND = 0,
KIRBY_WALK = 1,
KIRBY_ROLL = 2,
KIRBY_JUMP = 3,
KIRBY_STRAFE = 4,
// Base elements
TERRAIN = 5,
PARTICLE_1 = 6,
// Kirby sloped
KIRBY_SLOPED_25 = 7,
KIRBY_SLOPED_45 = 8,
KIRBY_SLOPED_25_LEFT = 9,
KIRBY_SLOPED_45_LEFT = 10,
// Sloped Terrain
TERRAIN_SLOPED_25 = 11,
TERRAIN_SLOPED_45 = 12,
// stage 1
MARGINTERRAINL = 13,
MARGINTERRAINR = 14,
SECONDTERRAINL = 15,
SECONDTERRAINR = 16,
// stage 2
TERRAIN2 = 17,
TERRAINBLOCK = 18,
// Stage 3
PLATFORMLEFT = 19,
PLATFORMCENTER = 20,
PLATFORMRIGHT = 21,
// title screen
TITLESCREEN = 22,
// KIRBY ACTION
KIRBY_INHALE = 23,
KIRBY_EXHALE = 24,
KIRBY_SPIT_CLOUD = 25,
KIRBY_BIG_FLYING = 26,
KIRBY_BIG_STAND = 27,
KIRBY_BIG_WALKING = 28,
BACKGROUND = 29,
UPCOLLIDER = 30,
TRANSPARENT = 31,
BACKGROUND1 = 32,
BACKGROUND2 = 33,
KIRBY_DOORS = 34,
LOBBY = 35,
BARRIER_1 = 36,
BARRIER_2 = 37,
// HUD
HUD_VIEW = 38,
HUD_HEALTH = 39,
HUD_LIVES = 40,
HUD_STAR = 41,
HUD_POWER = 42,
HUD_BACKDROP = 43,
HUD_BALL = 44,
HUD_BEAM = 45,
HUD_CRASH = 46,
HUD_CUTTER = 47,
HUD_FIRE = 48,
HUD_FIREBALL = 49,
HUD_FREEZE = 50,
HUD_HAMMER = 51,
HUD_HIGHJUMP = 52,
HUD_ICE = 53,
HUD_LASER = 54,
HUD_LIGHT = 55,
HUD_MIKE = 56,
HUD_NEEDLE = 57,
HUD_PARASOL = 58,
HUD_SLEEP = 59,
HUD_SPARK = 60,
HUD_STARROD = 61,
HUD_STONE = 62,
HUD_SWORD = 63,
HUD_THROW = 64,
HUD_TORNADO = 65,
HUD_UFO = 66,
HUD_WHEEL = 67,
HUD_MIX = 68,
HUD_NOTHING = 69,
HUD_HYPER = 70,
HUD_WORKSTAR = 71,
HUD_OUCH = 72,
HUD_MISS = 73,
HUD_GOAL = 74,
HUD_CLEAR = 75,
HUD_BYEBYE = 76,
HUD_PAUSE_POWER = 77,
HUD_PAUSE_BACKDROP = 78,
HUD_PAUSE_BALL = 79,
HUD_PAUSE_BEAM = 80,
HUD_PAUSE_CRASH = 81,
HUD_PAUSE_CUTTER = 82,
HUD_PAUSE_FIRE = 83,
HUD_PAUSE_FIREBALL = 84,
HUD_PAUSE_FREEZE = 85,
HUD_PAUSE_HAMMER = 86,
HUD_PAUSE_HIGHJUMP = 87,
HUD_PAUSE_ICE = 88,
HUD_PAUSE_LASER = 89,
HUD_PAUSE_LIGHT = 90,
HUD_PAUSE_MIKE = 91,
HUD_PAUSE_NEEDLE = 92,
HUD_PAUSE_PARASOL = 93,
HUD_PAUSE_SLEEP = 94,
HUD_PAUSE_SPARK = 95,
HUD_PAUSE_STARROD = 96,
HUD_PAUSE_STONE = 97,
HUD_PAUSE_SWORD = 98,
HUD_PAUSE_THROW = 99,
HUD_PAUSE_TORNADO = 100,
HUD_PAUSE_UFO = 101,
HUD_PAUSE_WHEEL = 102,
HUD_PAUSE_SCREEN = 103,
HUD_NUM_0 = 104,
HUD_NUM_1 = 105,
HUD_NUM_2 = 106,
HUD_NUM_3 = 107,
HUD_NUM_4 = 108,
HUD_NUM_5 = 109,
HUD_NUM_6 = 110,
HUD_NUM_7 = 111,
HUD_NUM_8 = 112,
HUD_NUM_9 = 113,
WADDLEDEE = 114,
WADDLEDOO = 115,
SPARKY = 116,
BRONTOBURT = 117,
POPPYBROSJR = 118,
HOTHEAD = 119,
SPARKY_JUMP = 120,
TITLESCREEN_INTRO = 121,
VEGETABLE_VALLEY_INTRO1 = 122,
DRAW_INTRO = 123,
COMMANDS_HUD = 124,
ABOUTUS_HUD = 125,
INTRO = 126,
// Kirby Ability
KIRBY_ASSORB = 127,
KIRBY_BEAM = 128,
KIRBY_FIRE = 129,
KIRBY_CUTTER = 130,
KIRBY_SPARK = 131,
KIRBY_FLY = 132,
BEAM = 133,
FIRE = 134,
SWORD = 135,
SPARK = 136,
FINALMESSAGE = 137
};
const int TEXTURE_COUNT = 138;
};
using namespace TexManager;
//static int QPixmapMaxSize = 32767;
static int QPixmapMaxSize = 1500;
class TextureManager {
public:
bool done = 0;
static TextureManager& getInstance() { static TextureManager instance; return instance; }
~TextureManager();
Animatable* getAnimatable(unsigned int position = 0) {
if (!textures[position]) {
std::cout << "Returned nullptr as texture. This is BAD\n";
}
return textures[position];}
//QPixmap getLevelBackground(const std::string& level);
static QRect moveBy(QRect rect, int x, int y = 0, int dx = 16, int dy = 16, int border_x = 4, int border_y = 9);
QPixmap* hudintronomi = 0;
QPixmap* introvegval1 = 0;
QPixmap* introdraw = 0;
QPixmap* introtex = 0;
void deleteLargeClips();
static QPixmap loadTexture(std::string file, QColor mask_color = Qt::magenta); // load texture with transparency using the given color as mask
private:
TextureManager();
TextureManager(TextureManager const&) = delete;
void operator=(TextureManager const&) = delete;
const std::string file_kirby = "sprites/Kirby.png";
const std::string file_enemy = "sprites/Enemies.png";
const std::string file_terrain = "sprites/SpriteBlocks.png";
const std::string file_terrain_part2 = "sprites/KirbyTileLevels.png";
const std::string file_titlescreen = "sprites/titlescreen.png";
const std::string file_background = "sprites/back.png";
const std::string file_upcollider = "sprites/Invisible.png";
const std::string file_background1 = "sprites/back2.png";
const std::string file_background2 = "sprites/back3.png";
const std::string file_lobby = "sprites/VegetableValley.png";
const std::string file_barriers = "sprites/Base.png";
const std::string file_HUDcomponents = "sprites/HUD_OLD.png";
const std::string file_HUDpause = "sprites/PauseUnicas.png";
const std::string file_HUDtitlescreenintro = "sprites/IntroNomi.png";
const std::string file_introvegetablevalley1 = "sprites/IntroVV.png";
const std::string file_introdraw = "sprites/IntroDraw.png";
const std::string file_commands = "sprites/CommandTest.png";
const std::string file_aboutus = "sprites/AboutUs.png";
const std::string file_intro = "sprites/Intro.png";
const std::string file_finalmessage = "sprites/FinalMessage.png";
QPixmap replaceColor(QPixmap pix, QColor old_color, QColor new_color);
Animatable* textures[TEXTURE_COUNT]{0};
std::thread threadLoad(Animatable** textures, TexID tex, std::string name, std::string extension, QRect size, unsigned int parts, unsigned int rowlength, unsigned int rows);
};