From 1f830a5e878ef0b00fcdeac88789a51ee16ff4b5 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Fri, 28 Jun 2024 18:00:34 -0700 Subject: [PATCH] feat: get system caps as a list --- ecsact/runtime/meta.hh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ecsact/runtime/meta.hh b/ecsact/runtime/meta.hh index 4e5a5e5a..25e799d7 100644 --- a/ecsact/runtime/meta.hh +++ b/ecsact/runtime/meta.hh @@ -447,6 +447,36 @@ ECSACT_ALWAYS_INLINE auto system_capabilities(SystemLikeID id) { return result; } +template +ECSACT_ALWAYS_INLINE auto system_capabilities_list(SystemLikeID id) { + using result_t = + std::vector>; + + const auto sys_like_id = ecsact_id_cast(id); + auto count = ecsact_meta_system_capabilities_count(sys_like_id); + std::vector components; + std::vector 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 ECSACT_ALWAYS_INLINE auto get_system_generates_ids(SystemLikeID id) { auto sys_like_id = ecsact_id_cast(id);