diff options
author | Aki <please@ignore.pl> | 2022-12-03 00:44:07 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-12-03 00:44:07 +0100 |
commit | 18a763bcb19c5ece4b7b7d079dab07a1d915deb6 (patch) | |
tree | 137278522c98f5cb5cf4067886444b20b3eaf82d /sim/include | |
parent | 18eba7f30381c05ee1c03bec5f537ec7d4dc9815 (diff) | |
download | kurator-18a763bcb19c5ece4b7b7d079dab07a1d915deb6.zip kurator-18a763bcb19c5ece4b7b7d079dab07a1d915deb6.tar.gz kurator-18a763bcb19c5ece4b7b7d079dab07a1d915deb6.tar.bz2 |
Moved battles module files to sim
Diffstat (limited to 'sim/include')
-rw-r--r-- | sim/include/kurator/sim/Battle.h | 31 | ||||
-rw-r--r-- | sim/include/kurator/sim/Point.h | 26 | ||||
-rw-r--r-- | sim/include/kurator/sim/Scenario.h | 24 | ||||
-rw-r--r-- | sim/include/kurator/sim/ShipConfig.h | 22 | ||||
-rw-r--r-- | sim/include/kurator/sim/components.h | 59 | ||||
-rw-r--r-- | sim/include/kurator/sim/events.h | 21 | ||||
-rw-r--r-- | sim/include/kurator/sim/scenarios.h | 19 |
7 files changed, 202 insertions, 0 deletions
diff --git a/sim/include/kurator/sim/Battle.h b/sim/include/kurator/sim/Battle.h new file mode 100644 index 0000000..1542597 --- /dev/null +++ b/sim/include/kurator/sim/Battle.h @@ -0,0 +1,31 @@ +#pragma once + +#include <memory> + +#include <entt/entity/registry.hpp> +#include <entt/signal/dispatcher.hpp> + +#include "Scenario.h" + + +namespace kurator +{ +namespace battles +{ + + +class Battle +{ +public: + virtual ~Battle() = default; + virtual entt::registry& registry() = 0; + virtual entt::dispatcher& dispatcher() = 0; + virtual void update(float dt) = 0; +}; + + +auto prepare(const Scenario& scenario) -> std::unique_ptr<Battle>; + + +} // namespace battles +} // namespace kurator diff --git a/sim/include/kurator/sim/Point.h b/sim/include/kurator/sim/Point.h new file mode 100644 index 0000000..ba9ab63 --- /dev/null +++ b/sim/include/kurator/sim/Point.h @@ -0,0 +1,26 @@ +#pragma once + + +namespace kurator +{ +namespace battles +{ + + +struct Point +{ + double x; + double y; + double magnitude() const; + double distance(const Point& other) const; + double angle() const; + Point rotate(double angle) const; + Point scale(double _scale) const; + Point normalized() const; + Point operator-(const Point& other) const; + Point operator+(const Point& other) const; +}; + + +} // namespace battles +} // namespace kurator diff --git a/sim/include/kurator/sim/Scenario.h b/sim/include/kurator/sim/Scenario.h new file mode 100644 index 0000000..afbb74c --- /dev/null +++ b/sim/include/kurator/sim/Scenario.h @@ -0,0 +1,24 @@ +#pragma once + +#include <string> +#include <vector> + +#include "ShipConfig.h" + + +namespace kurator +{ +namespace battles +{ + + +struct Scenario +{ + std::string name; + std::vector<ShipConfig> ships; + int total_teams() const; +}; + + +} // namespace battles +} // namespace kurator diff --git a/sim/include/kurator/sim/ShipConfig.h b/sim/include/kurator/sim/ShipConfig.h new file mode 100644 index 0000000..2066430 --- /dev/null +++ b/sim/include/kurator/sim/ShipConfig.h @@ -0,0 +1,22 @@ +#pragma once + +#include <string> +#include <vector> + + +namespace kurator +{ +namespace battles +{ + + +struct ShipConfig +{ + int team; + std::string type; + std::vector<std::string> turrets; +}; + + +} // namespace battles +} // namespace kurator diff --git a/sim/include/kurator/sim/components.h b/sim/include/kurator/sim/components.h new file mode 100644 index 0000000..d4363c4 --- /dev/null +++ b/sim/include/kurator/sim/components.h @@ -0,0 +1,59 @@ +#pragma once + +#include <entt/entity/entity.hpp> + +#include "Point.h" + + +namespace kurator +{ +namespace battles +{ + + +struct Transform +{ + Point position; + double angle; + entt::entity reference_frame = entt::null; +}; + + +struct Team +{ + int id; +}; + + +struct AIState +{ + Point destination; + entt::entity target = entt::null; +}; + + +struct FloatingMovement +{ + double max_speed; + double acceleration; + double deceleration; + double destination_boundary; + Point speed = {0.0, 0.0}; +}; + + +struct HitPoints +{ + double health; +}; + + +struct TurretControl +{ + double reload; + entt::entity owner; +}; + + +} // namespace battles +} // namespace kurator diff --git a/sim/include/kurator/sim/events.h b/sim/include/kurator/sim/events.h new file mode 100644 index 0000000..0e4af14 --- /dev/null +++ b/sim/include/kurator/sim/events.h @@ -0,0 +1,21 @@ +#pragma once + +#include <entt/entity/entity.hpp> + + +namespace kurator +{ +namespace battles +{ + + +struct Hit +{ + double damage; + entt::entity source; + entt::entity victim; +}; + + +} // namespace battles +} // namespace kurator diff --git a/sim/include/kurator/sim/scenarios.h b/sim/include/kurator/sim/scenarios.h new file mode 100644 index 0000000..3d7e697 --- /dev/null +++ b/sim/include/kurator/sim/scenarios.h @@ -0,0 +1,19 @@ +#pragma once + +#include "Scenario.h" + + +namespace kurator +{ +namespace battles +{ +namespace scenarios +{ + + +Scenario example(); + + +} // namespace scenarios +} // namespace battles +} // namespace kurator |