diff options
author | Aki <please@ignore.pl> | 2022-11-10 00:30:43 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-11-10 00:30:43 +0100 |
commit | 57cd7872a624179f3c37c20cef488ce2be6666bc (patch) | |
tree | 32a581b4ed54eb388efaa537bb8e5c63b541802b /battles/src | |
parent | 9de52991aaec19076cc79b54e097444532b5300f (diff) | |
download | kurator-57cd7872a624179f3c37c20cef488ce2be6666bc.zip kurator-57cd7872a624179f3c37c20cef488ce2be6666bc.tar.gz kurator-57cd7872a624179f3c37c20cef488ce2be6666bc.tar.bz2 |
Added positions to "ships" in battle and cleaned up battle scene
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++; } |