-
Notifications
You must be signed in to change notification settings - Fork 0
/
Type.hpp
160 lines (137 loc) · 2.83 KB
/
Type.hpp
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
#pragma once
#include <vector>
#include <map>
#include <string>
#include <functional>
/*-----Core-----*/
enum KiwiBool {
NotKiwi = false,
Kiwi = true
};
struct LibSelector {
std::vector<std::string>::iterator selected;
std::vector<std::string> list;
};
struct Menu {
int score;
std::string name;
LibSelector graphical;
LibSelector game;
};
struct SelectedLib {
std::string graphical;
std::string game;
};
enum Input {
UP,
DOWN,
LEFT,
RIGHT,
QUIT,
MENU,
ACTION,
RESET,
NEXT_DI,
NEXT_GA
};
struct Vector2D {
float x;
float y;
Input rotation;
Vector2D() = default;
Vector2D(float X, float Y) : x(X), y(Y), rotation(RIGHT) {}
Vector2D(float X, float Y, Input R) : x(X), y(Y), rotation(R) {}
Vector2D operator+(Vector2D other) const {
return {x + other.x, y + other.y, rotation};
}
Vector2D operator-(Vector2D other) const {
return {x - other.x, y - other.y, rotation};
}
Vector2D& operator+=(Vector2D other) {
x += other.x;
y += other.y;
return *this;
}
Vector2D& operator-=(Vector2D other) {
x -= other.x;
y -= other.y;
return *this;
}
bool operator==(Vector2D other) {
return x == other.x && y == other.y && rotation == other.rotation;
}
bool operator!=(Vector2D other) {
return x != other.x || y != other.y || rotation != other.rotation;
}
};
enum EntityType {
UNDEFINED,
WALL,
PLAYER,
PLAYER_SEC,
PLAYER_THD,
PLAYER_MOVE,
PLAYER_DYING,
ENEMY,
ENEMY1,
ENEMY1_SEC,
ENEMY1_MOVE,
ENEMY1_DYING,
ENEMY2,
ENEMY2_SEC,
ENEMY2_MOVE,
ENEMY2_DYING,
ENEMY3,
ENEMY3_SEC,
ENEMY3_MOVE,
ENEMY3_DYING,
ENEMY4,
ENEMY4_SEC,
ENEMY4_MOVE,
ENEMY4_DYING,
ENEMY5,
ENEMY5_SEC,
ENEMY5_MOVE,
ENEMY5_DYING,
ITEM1,
ITEM2,
ITEM3,
ITEM4,
ITEM5,
ITEM6,
ITEM7,
ITEM8,
ITEM9,
BULLET,
ENTITY_MAX // leave that at the end
};
using Map = std::vector<std::vector<EntityType>>;
using EntitiesDescription = std::vector<std::pair<EntityType, Vector2D>>;
enum Signature {
GAME = 404,
GRAPHICAL = 808,
};
class IEntity {
protected:
EntityType entityType;
Vector2D position;
bool visibility;
public:
virtual ~IEntity() = default;
virtual EntityType getEntityType() const = 0;
virtual void setEntityType(EntityType) = 0;
virtual Vector2D getPosition() const = 0;
virtual void setPosition(Vector2D position) = 0;
virtual bool getVisibility() const = 0;
virtual void setVisibility(bool visibility) = 0;
};
enum GameState {
RUNNING,
WIN,
GAMEOVER,
SPLASH
};
enum StaticScreen {
SCREEN_SPLASH,
SCREEN_GAMEOVER
};