summaryrefslogtreecommitdiffstats
path: root/include/entitycomponents.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/entitycomponents.hpp')
-rw-r--r--include/entitycomponents.hpp58
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