diff --git a/dECS/CMakeLists.txt b/dECS/CMakeLists.txt index c100db7e..f5dce280 100644 --- a/dECS/CMakeLists.txt +++ b/dECS/CMakeLists.txt @@ -5,6 +5,7 @@ add_library(dECS STATIC "Core.h" "Iter.h" "Core.cpp" + "System.cpp" ) target_include_directories(dECS PUBLIC .) target_link_libraries(dECS PRIVATE dCommon magic_enum::magic_enum) diff --git a/dECS/System.cpp b/dECS/System.cpp new file mode 100644 index 00000000..88ea1f7f --- /dev/null +++ b/dECS/System.cpp @@ -0,0 +1,52 @@ +#include "PetComponent.h" +#include "MovementAIComponent.h" +#include "MissionComponent.h" +#include "eMissionState.h" + +using Pet = PetComponent; +using Mission = MissionComponent; +using MovementAI = MovementAIComponent; + +struct Position : NiPoint3 {}; +struct Treasure {}; + +namespace decs { + template + class System { + public: + template + void each(Fn&& fn) { + fn(); + } + }; + + class Scene { + public: + template + System system() { + return System{}; + } + }; +} + +void run() { + auto scene = decs::Scene{}; + + scene.system() + .each([](Pet& pet) { + + }); + + scene.system() + .each([](Pet& pet, MovementAI& move) { + + }); + + scene.system() + .each([](Pet& pet, Mission const& mission, Position const& pos) { + auto const digUnlocked = mission.GetMissionState(842) == eMissionState::COMPLETE; + auto const treasurePos = PetDigServer::GetClosestTreasure(pos); + + + }); +}