-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tema1.h
192 lines (140 loc) · 4.93 KB
/
Tema1.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
#pragma once
#include "components/simple_scene.h"
namespace m1
{
class Tema1 : public gfxc::SimpleScene
{
public:
Tema1();
~Tema1();
void Init() override;
private:
void FrameStart() override;
void Update(float deltaTimeSeconds) override;
void FrameEnd() override;
void OnInputUpdate(float deltaTime, int mods) override;
void OnKeyPress(int key, int mods) override;
void OnKeyRelease(int key, int mods) override;
void OnMouseMove(int mouseX, int mouseY, int deltaX, int deltaY) override;
void OnMouseBtnPress(int mouseX, int mouseY, int button, int mods) override;
void OnMouseBtnRelease(int mouseX, int mouseY, int button, int mods) override;
void OnMouseScroll(int mouseX, int mouseY, int offsetX, int offsetY) override;
void OnWindowResize(int width, int height) override;
protected:
float cx, cy;
glm::mat3 modelMatrixSquare;
glm::mat3 modelMatrixRectangle;
glm::mat3 modelMatrixPistol[5];
glm::mat3 modelMatrixHexagon;
glm::mat3 modelMatrixHexagonNew[100]; // PUT A LOWER NUMBER !!!!!!!
glm::mat3 modelMatrixStar;
glm::mat3 modelMatrixRedSquare;
glm::mat3 modelMatrixPistolSquare;
glm::mat3 modelMatrixPistolNew[10];
glm::mat3 modelMatrixPinkStar;
glm::mat3 modelMatrixProjectile[30];
glm::mat3 modelMatrixProjectilePurple[30];
glm::mat3 modelMatrixProjectileBlue[30];
glm::mat3 modelMatrixProjectileOrange[30];
glm::mat3 modelMatrixProjectileYellow[30];
int angularStep = 0;
// Hexagone translation
int translateY[6] = { 0 };
// Which pistol is being pressed
int pressed = 0;
// Coordinates of the mouse
int mouseXglobal;
int mouseYglobal;
// For randomizing
int randomY[3] = { 40, 115, 190 };
std::string randomHexagon[4] = { "hexagon_purple", "hexagon_orange", "hexagon_blue", "hexagon_yellow" };
// Initializations for randomizing hexagones spawning
bool shouldSpawn = true;
int random_hexagon = 0;
float time_passed = 0;
int hexagones_spawned = 0;
// Number of lives
int no_lives = 3;
struct Square {
// Edges of the square
int up;
int down;
int left;
int right;
// Coordinates of the pistol in the square
int translateX;
int translateY;
int waiting = 0; // Waiting for a pistol to be drawn
int occupied = 0; // Marking if a square is occupied
int destroy = 0; // For the scale animation
float scaleX = 1;
float scaleY = 1;
int sign2 = 1;
std::string aux[10] = {"nothing", "projectilepurple", "projectileorange", "projectileblue", "projectileyellow"};
std::string color;
int colorIndex = 0;
int RIGHT_PRESSED = 0; // Checking if I need to get rid of a pistol
};
float spawnTimer = 0.0f; // Initialize a timer for projectile spawning
float spawnInterval = 3.0f; // Set the interval for spawning projectiles
// Edges of the pistol square (top)
struct SquarePistol {
int up;
int down;
int left;
int right;
};
// Enemies
struct Hexagon {
float time_elapsed = 0;
float time_until_spawn = 0;
bool spawned = false;
int random_translateY = 0;
int translateX = 0;
std::string random_color;
int shouldDie = 0;
float scaleX = 1;
float scaleY = 1;
int sign2 = 1;
int lives = 3;
int row = 0;
int colorIndex = 0;
};
struct PinkStar {
int up;
int down;
int left;
int right;
int randomX = -1;
int randomY = -1;
int live = 0;
int rendered = 0;
};
struct StarPoints {
int starsCollected = 5;
int actualLength = 850;
int pistol1 = 1;
int pistol2 = 2;
int pistol3 = 2;
int pistol4 = 3;
};
int projectiles_spawned = 0;
float projectile_spawn_time[20] = { 3.0f };
struct Projectile {
int translateX = 0;
int translateY = 0;
int spawn = 0;
int colour;
int collision = 0;
int hexagonCollisionIndex = 0;
int row = 0;
};
Projectile projectile[30][30];
StarPoints starPoints;
float pinkStarSpawnTime = 1.5f;
Hexagon hexagon[10];
SquarePistol square_pistol[5];
Square square[10];
PinkStar pinkstar;
};
} // namespace m1