diff --git a/SHADE_Engine/src/ECS_Base/SHECSMacros.h b/SHADE_Engine/src/ECS_Base/SHECSMacros.h index 5243e20f..0a8971e7 100644 --- a/SHADE_Engine/src/ECS_Base/SHECSMacros.h +++ b/SHADE_Engine/src/ECS_Base/SHECSMacros.h @@ -11,6 +11,8 @@ typedef uint16_t EntityIndex; typedef uint32_t ComponentTypeID; + + const EntityIndex MAX_EID = 51000; diff --git a/SHADE_Engine/src/ECS_Base/System/SHComponentManager.h b/SHADE_Engine/src/ECS_Base/System/SHComponentManager.h index 2f6ff504..2c747663 100644 --- a/SHADE_Engine/src/ECS_Base/System/SHComponentManager.h +++ b/SHADE_Engine/src/ECS_Base/System/SHComponentManager.h @@ -25,6 +25,10 @@ namespace SHADE { + + + typedef SHFamilyID ComponentFamily; + class SHComponentManager { private: @@ -36,6 +40,8 @@ namespace SHADE friend struct SHSceneNode; + + /************************************************************************** @@ -225,7 +231,7 @@ namespace SHADE * \return * none ***************************************************************************/ - static void AddComponent(EntityID entityID, uint32_t componentTypeID) noexcept + static void AddComponent(EntityID entityID, ComponentTypeID componentTypeID) noexcept { componentSet.GetSparseSet_ID(componentTypeID)->Add(EntityHandleGenerator::GetIndex(entityID)); @@ -277,7 +283,7 @@ namespace SHADE * \return bool * True if the entity has a component of specified type. ***************************************************************************/ - static bool HasComponent_ID(EntityID entityID, uint32_t componentTypeID) noexcept; + static bool HasComponent_ID(EntityID entityID, ComponentTypeID componentTypeID) noexcept; /*!************************************************************************* @@ -362,7 +368,7 @@ namespace SHADE * \return * ***************************************************************************/ - static void SwapInDenseByIndexHash_ID(EntityIndex index, EntityID hash, uint32_t componentTypeID) noexcept; + static void SwapInDenseByIndexHash_ID(EntityIndex index, EntityID hash, ComponentTypeID componentTypeID) noexcept; @@ -385,7 +391,7 @@ namespace SHADE * \return * The number of components in the component sparse set. ***************************************************************************/ - static EntityIndex ComponentCount_ID(uint32_t componentTypeID) + static EntityIndex ComponentCount_ID(ComponentTypeID componentTypeID) { return componentSet.GetSparseSet_ID(componentTypeID)->Count(); } @@ -402,9 +408,9 @@ namespace SHADE static void SetActive(EntityID entityID, bool active) noexcept; template - static std::enable_if_t<(... && std::is_base_of_v), uint32_t> CreateComponentGroup(uint32_t numOwningComponents) + static std::enable_if_t<(... && std::is_base_of_v), uint32_t> CreateComponentGroup(ComponentTypeID numOwningComponents) { - std::vector templateIDs{ (SHFamilyID::GetID())... }; + std::vector templateIDs{ (ComponentFamily::GetID())... }; for (auto& g : componentGroups) { @@ -421,11 +427,11 @@ namespace SHADE } SHComponentGroup grp; - for (uint32_t i = 0; i < numOwningComponents; ++i) + for (ComponentTypeID i = 0; i < numOwningComponents; ++i) { grp.ownedComponentTypes.push_back(templateIDs[i]); } - for (uint32_t i = 0; i < templateIDs.size(); ++i) + for (ComponentTypeID i = 0; i < templateIDs.size(); ++i) { grp.componentTypeIDs.push_back(templateIDs[i]); } diff --git a/SHADE_Engine/src/ECS_Base/System/SHSystem.h b/SHADE_Engine/src/ECS_Base/System/SHSystem.h index 1a304605..817b9718 100644 --- a/SHADE_Engine/src/ECS_Base/System/SHSystem.h +++ b/SHADE_Engine/src/ECS_Base/System/SHSystem.h @@ -11,8 +11,13 @@ #ifndef SH_SYSTEM_H #define SH_SYSTEM_H + + namespace SHADE { + + + class SHSystem { protected: diff --git a/SHADE_Engine/src/ECS_Base/System/SHSystemManager.h b/SHADE_Engine/src/ECS_Base/System/SHSystemManager.h index d5a4866d..a81370e9 100644 --- a/SHADE_Engine/src/ECS_Base/System/SHSystemManager.h +++ b/SHADE_Engine/src/ECS_Base/System/SHSystemManager.h @@ -20,11 +20,16 @@ #include #include #include "../System/SHSystem.h" - +#include "../General/SHFamily.h" namespace SHADE { + typedef uint32_t SystemTypeID; + typedef uint32_t SystemVersionID; + typedef uint64_t SystemID; + typedef SHFamilyID SystemFamily; + class SHSystemManager { //type definition for the container we use to store our system