diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2022-06-22 17:41:59 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2022-06-22 17:41:59 -0400 |
commit | 5e3a2492c7bb73daa4e27398daaf490d09980ff3 (patch) | |
tree | 75178d823d596b6a898002c3f1d45b9ceede0e1e /include/entitycomponents.hpp | |
download | systemviewer-5e3a2492c7bb73daa4e27398daaf490d09980ff3.tar.gz systemviewer-5e3a2492c7bb73daa4e27398daaf490d09980ff3.tar.bz2 systemviewer-5e3a2492c7bb73daa4e27398daaf490d09980ff3.zip |
Base system viewer with data loaded from csv files
Diffstat (limited to 'include/entitycomponents.hpp')
-rw-r--r-- | include/entitycomponents.hpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/entitycomponents.hpp b/include/entitycomponents.hpp new file mode 100644 index 0000000..a263ebf --- /dev/null +++ b/include/entitycomponents.hpp @@ -0,0 +1,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 |