Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: get system caps as a list #256

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading