summaryrefslogtreecommitdiffstats
path: root/include/entitycomponents.hpp
blob: a263ebf87010f7d90c23aa421f1595fc5c17cc90 (plain) (blame)
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
#ifndef ENTITY_COMPONENT_HPP
#define ENTITY_COMPONENT_HPP 1

#include "vex.hpp"
#include "units.hpp"
#include <bitset>

namespace ecs {
struct PositionComponent {
    vex::vec2<long> position{};
};

struct VelocityComponent {
    vex::vec2<long> velocity{};
};

struct MassComponent {
    unit::Mass mass;
};

struct NameComponent {
    std::string name;
};

struct OrbitalComponent {
    unsigned origin;
    long a;
    double e;
    double w;
    double M;
    double T;
    double v;
};

struct RenderCircleComponent {
    unsigned radius;
};

using component_variant = std::variant<
    std::monostate,
    PositionComponent,
    VelocityComponent,
    MassComponent,
    NameComponent,
    OrbitalComponent,
    RenderCircleComponent
>;

using component_sig = 
    std::bitset<std::variant_size_v<component_variant>>; 

template<typename T>
concept component_type =
    is_variant_v<T, component_variant>;

}

#endif