diff options
Diffstat (limited to 'battles/src')
-rw-r--r-- | battles/src/Battle.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/battles/src/Battle.cpp b/battles/src/Battle.cpp index 699b9c4..e59f951 100644 --- a/battles/src/Battle.cpp +++ b/battles/src/Battle.cpp @@ -1,5 +1,10 @@ #include <kurator/battles/Battle.h> +#include <cmath> +#include <random> + +#include <entt/entity/entity.hpp> + #include <kurator/battles/components.h> #include <kurator/battles/Scenario.h> #include <kurator/universe/ShipType.h> @@ -13,12 +18,15 @@ namespace battles Battle::Battle(Scenario scenario) { + std::random_device dev; + std::uniform_real_distribution<> pos{-5.0, 5.0}; 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); + registry.emplace<Transform>(entity, Point{pos(dev), pos(dev)}, Point{0.0, 0.0}); } team++; } |