1 #ifndef ENTT_ENTITY_HELPER_HPP
2 #define ENTT_ENTITY_HELPER_HPP
6 #include "../config/config.h"
7 #include "../core/type_traits.hpp"
8 #include "../signal/delegate.hpp"
9 #include "registry.hpp"
20 template<
typename Entity>
39 template<
typename Exclude,
typename... Component>
41 return reg.template
view<Component...>(Exclude{});
57 template<
typename Entity>
62 template<
typename Entity>
70 template<
typename Entity>
90 template<
typename Exclude,
typename Get,
typename... Owned>
92 if constexpr(std::is_const_v<registry_type>) {
93 return reg.template group_if_exists<Owned...>(Get{}, Exclude{});
95 return reg.template
group<Owned...>(Get{}, Exclude{});
112 template<
typename Entity>
117 template<
typename Entity>
129 template<auto Member,
typename Entity = entity>
131 static_assert(std::is_member_function_pointer_v<decltype(Member)>,
"Invalid pointer to non-static member function");
146 template<
typename Entity,
typename Component>
148 return *(reg.template data<Component>() + (&component - reg.template raw<Component>()));
constness_as_t< basic_registry< entity_type >, Entity > registry_type
Type of registry to convert.
constexpr get_t< Type... > get
Variable template for lists of observed components.
as_view(registry_type &source) noexcept
Constructs a converter for a given registry.
Converts a registry to a group.
as_group(registry_type &source) noexcept
Constructs a converter for a given registry.
as_group(basic_registry< Entity > &) noexcept -> as_group< Entity >
Deduction guide.
Entity to_entity(const basic_registry< Entity > ®, const Component &component)
Returns the entity associated with a given component.
void invoke(basic_registry< Entity > ®, const Entity entt)
Helper to create a listener that directly invokes a member function.
Fast and reliable entity-component system.
as_view(basic_registry< Entity > &) noexcept -> as_view< Entity >
Deduction guide.
std::remove_const_t< Entity > entity_type
Underlying entity identifier.
Converts a registry to a view.
constness_as_t< basic_registry< entity_type >, Entity > registry_type
Type of registry to convert.
Basic delegate implementation.
typename constness_as< To, From >::type constness_as_t
Alias template to facilitate the transcription of the constness.
std::remove_const_t< Entity > entity_type
Underlying entity identifier.
typename member_class< Member >::type member_class_t
Helper type.