summaryrefslogtreecommitdiff
path: root/battles
diff options
context:
space:
mode:
Diffstat (limited to 'battles')
-rw-r--r--battles/include/kurator/battles/Point.h18
-rw-r--r--battles/include/kurator/battles/components.h29
-rw-r--r--battles/src/Battle.cpp13
3 files changed, 59 insertions, 1 deletions
diff --git a/battles/include/kurator/battles/Point.h b/battles/include/kurator/battles/Point.h
new file mode 100644
index 0000000..71a6993
--- /dev/null
+++ b/battles/include/kurator/battles/Point.h
@@ -0,0 +1,18 @@
+#pragma once
+
+
+namespace kurator
+{
+namespace battles
+{
+
+
+struct Point
+{
+ double x;
+ double y;
+};
+
+
+} // namespace battles
+} // namespace kurator
diff --git a/battles/include/kurator/battles/components.h b/battles/include/kurator/battles/components.h
new file mode 100644
index 0000000..03b93a2
--- /dev/null
+++ b/battles/include/kurator/battles/components.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <entt/entity/entity.hpp>
+
+#include "Point.h"
+
+
+namespace kurator
+{
+namespace battles
+{
+
+
+struct Transform
+{
+ Point position;
+ Point rotation;
+ entt::entity reference_frame = entt::null;
+};
+
+
+struct Team
+{
+ int id;
+};
+
+
+} // namespace battles
+} // namespace kurator
diff --git a/battles/src/Battle.cpp b/battles/src/Battle.cpp
index e185a68..699b9c4 100644
--- a/battles/src/Battle.cpp
+++ b/battles/src/Battle.cpp
@@ -1,6 +1,8 @@
#include <kurator/battles/Battle.h>
+#include <kurator/battles/components.h>
#include <kurator/battles/Scenario.h>
+#include <kurator/universe/ShipType.h>
namespace kurator
@@ -9,8 +11,17 @@ namespace battles
{
-Battle::Battle(Scenario)
+Battle::Battle(Scenario scenario)
{
+ int team = 0;
+ for (const auto& ships : scenario.teams) {
+ for (const auto& ship : ships) {
+ const auto entity = registry.create();
+ registry.emplace<universe::ShipType>(entity, ship.type);
+ registry.emplace<Team>(entity, team);
+ }
+ team++;
+ }
}