diff options
author | Aki <please@ignore.pl> | 2023-02-11 16:50:09 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-02-11 17:08:00 +0100 |
commit | e66011756340e03fe941723f762119ed78ec2402 (patch) | |
tree | 5d699632b0d7683c96f5db81ba440d81bbac338e /engine | |
parent | f9269a45b82f637173e30760e1f4febc7ccb2b3e (diff) | |
download | kurator-e66011756340e03fe941723f762119ed78ec2402.zip kurator-e66011756340e03fe941723f762119ed78ec2402.tar.gz kurator-e66011756340e03fe941723f762119ed78ec2402.tar.bz2 |
Added ConstContext for drawing systems
This whole ongoing refactoring process is meant to better understand
relationships between Battle, Simulation and Systems.
Diffstat (limited to 'engine')
-rw-r--r-- | engine/include/kurator/engine/Context.h | 23 | ||||
-rw-r--r-- | engine/src/Context.cpp | 25 |
2 files changed, 45 insertions, 3 deletions
diff --git a/engine/include/kurator/engine/Context.h b/engine/include/kurator/engine/Context.h index c2c7cca..093285e 100644 --- a/engine/include/kurator/engine/Context.h +++ b/engine/include/kurator/engine/Context.h @@ -3,6 +3,7 @@ #include <entt/entity/registry.hpp> #include <entt/signal/dispatcher.hpp> +#include "Camera.h" #include "Clock.h" @@ -12,12 +13,32 @@ namespace engine { +struct Context; +struct ConstContext; + + struct Context { - Context(entt::registry& registry_, entt::dispatcher& dispatcher_, Clock& clock_); + Context(entt::registry& registry_, entt::dispatcher& dispatcher_, Clock& clock_, Camera& camera_); entt::registry& registry; entt::dispatcher& dispatcher; Clock& clock; + Camera& camera; + operator ConstContext() const; +}; + + +struct ConstContext +{ + ConstContext( + const entt::registry& registry_, + const entt::dispatcher& dispatcher_, + const Clock& clock_, + const Camera& camera_); + const entt::registry& registry; + const entt::dispatcher& dispatcher; + const Clock& clock; + const Camera& camera; }; diff --git a/engine/src/Context.cpp b/engine/src/Context.cpp index eeec938..8c81c89 100644 --- a/engine/src/Context.cpp +++ b/engine/src/Context.cpp @@ -3,6 +3,7 @@ #include <entt/entity/registry.hpp> #include <entt/signal/dispatcher.hpp> +#include <kurator/engine/Camera.h> #include <kurator/engine/Clock.h> @@ -12,10 +13,30 @@ namespace engine { -Context::Context(entt::registry& registry_, entt::dispatcher& dispatcher_, Clock& clock_) : +Context::Context(entt::registry& registry_, entt::dispatcher& dispatcher_, Clock& clock_, Camera& camera_) : registry {registry_}, dispatcher {dispatcher_}, - clock {clock_} + clock {clock_}, + camera {camera_} +{ +} + + +Context::operator ConstContext() const +{ + return ConstContext{registry, dispatcher, clock, camera}; +} + + +ConstContext::ConstContext( + const entt::registry& registry_, + const entt::dispatcher& dispatcher_, + const Clock& clock_, + const Camera& camera_) : + registry {registry_}, + dispatcher {dispatcher_}, + clock {clock_}, + camera {camera_} { } |