diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-07 14:18:54 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-07 14:18:54 +0100 |
commit | 90c6bf03e59fdec64f850310bcbff45ae86f69e3 (patch) | |
tree | f80305e8b712e17c41a1860ec82a139842c67ba0 /src/crepe/manager/ComponentManager.h | |
parent | f4824f5e7e6cee12bec602f3240770945a73d043 (diff) |
more script utilities
Diffstat (limited to 'src/crepe/manager/ComponentManager.h')
-rw-r--r-- | src/crepe/manager/ComponentManager.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/crepe/manager/ComponentManager.h b/src/crepe/manager/ComponentManager.h index 5f2cf3c..4e53954 100644 --- a/src/crepe/manager/ComponentManager.h +++ b/src/crepe/manager/ComponentManager.h @@ -135,10 +135,30 @@ public: */ template <typename T> RefVector<T> get_components_by_type() const; + /** + * \brief Get all components of a specific type on a GameObject with name \c name + * + * \tparam T The type of the component + * \param name Metadata::name for the same game_object_id as the returned components + * \return Components matching criteria + */ + template <typename T> + RefVector<T> get_components_by_name(const std::string & name) const; + /** + * \brief Get all components of a specific type on a GameObject with tag \c tag + * + * \tparam T The type of the component + * \param name Metadata::tag for the same game_object_id as the returned components + * \return Components matching criteria + */ + template <typename T> + RefVector<T> get_components_by_tag(const std::string & tag) const; private: template <typename T> std::set<game_object_id_t> get_objects_by_predicate(const std::function<bool (const T &)> & pred) const; + template <typename T> + RefVector<T> get_components_by_ids(const std::set<game_object_id_t> & ids) const; std::set<game_object_id_t> get_objects_by_name(const std::string & name) const; std::set<game_object_id_t> get_objects_by_tag(const std::string & tag) const; |