-
Notifications
You must be signed in to change notification settings - Fork 0
/
components.hpp
98 lines (75 loc) · 1.79 KB
/
components.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
#pragma once
#include "entt/entity/registry.hpp"
#include "texture.hpp"
#include <glm/glm.hpp>
struct CoItem {
glm::vec2 size;
glm::vec2 pos;
float rotation;
};
struct CoKinematics {
CoKinematics(float mass, glm::vec2 vel, float angVel)
: mass(mass), vel(vel), force({0.0f, 0.0f}), angVel(angVel),
angForce(0.0f), bumpCount(0){};
float mass;
glm::vec2 vel;
glm::vec2 force;
float angVel;
float angForce;
int bumpCount;
};
struct CoKinematicsSimple {
CoKinematicsSimple(float mass, glm::vec2 vel, float angVel)
: mass(mass), vel(vel), force({0.0f, 0.0f}), angVel(angVel),
angForce(0.0f), bumpCount(0){};
float mass;
glm::vec2 vel;
glm::vec2 force;
float angVel;
float angForce;
int bumpCount;
};
struct CoSprite {
Texture *tex;
float frame;
};
struct CoPlayerAligned {
entt::entity player;
};
struct CoTorpedo {
float age = 0.0f;
};
struct CoExplosion {
CoExplosion(float explosionDiam, int fragmentLevel)
: age(0.0f), explosionDiam(explosionDiam), fragmentLevel(fragmentLevel){};
float age;
float explosionDiam;
bool fragmented = false;
int fragmentLevel = 0;
};
enum class PLAYER_STATE { ALIVE, ALIVE_PROTECTED, RESPAWNING, KILLED };
struct CoPlayer {
CoPlayer(int keySet) : keySet(keySet){};
float torpedoCooldown = 0.0;
float torpedosLoaded = 10.0;
float timer = 0.1f;
PLAYER_STATE state = PLAYER_STATE::ALIVE_PROTECTED;
int deaths = 0;
int kills = 0;
int torpedosFired = 0;
int keySet = 0;
};
struct CoAgent {};
struct CoRespawnsOoB {};
struct CoDeletedOoB {};
struct CoDecays {
float halflife;
};
struct CoTarget {};
struct CoHasTracer {};
struct CoAnimated {
float frame;
};
inline float &frame(entt::registry ®istry, entt::entity entity) {
return registry.get<CoAnimated>(entity).frame;
}