Skip to content

Commit

Permalink
feat: get system caps as a list
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Jul 2, 2024
1 parent 64b81d7 commit 924bfc1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ecsact/runtime/meta.hh
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,36 @@ ECSACT_ALWAYS_INLINE auto system_capabilities(SystemLikeID id) {
return result;
}

template<typename SystemLikeID>
ECSACT_ALWAYS_INLINE auto system_capabilities_list(SystemLikeID id) {
using result_t =
std::vector<std::pair<ecsact_component_like_id, ecsact_system_capability>>;

const auto sys_like_id = ecsact_id_cast<ecsact_system_like_id>(id);
auto count = ecsact_meta_system_capabilities_count(sys_like_id);
std::vector<ecsact_component_like_id> components;
std::vector<ecsact_system_capability> capabilities;
components.resize(count);
capabilities.resize(count);

ecsact_meta_system_capabilities(
sys_like_id,
count,
components.data(),
capabilities.data(),
nullptr
);

result_t result;
result.reserve(count);

for(decltype(count) i = 0; count > i; ++i) {
result.emplace_back(components[i], capabilities[i]);
}

return result;
}

template<typename SystemLikeID>
ECSACT_ALWAYS_INLINE auto get_system_generates_ids(SystemLikeID id) {
auto sys_like_id = ecsact_id_cast<ecsact_system_like_id>(id);
Expand Down

0 comments on commit 924bfc1

Please # to comment.