88 return entity.has<
C>();
91 if constexpr(std::is_default_constructible_v<C>) {
150#define CE_EDITOR_COMPONENT_TOKENPASTE(x, y) x##y
151#define CE_EDITOR_COMPONENT_TOKENPASTE2(x, y) CE_EDITOR_COMPONENT_TOKENPASTE(x, y)
152#define CE_EDITOR_COMPONENT(...) \
153 static const ::CeresEngine::Editor::UI::TComponentUI<__VA_ARGS__> CE_EDITOR_COMPONENT_TOKENPASTE2(componentUI, __COUNTER__) [[maybe_unused]] = [ \
154 ](::CeresEngine::Editor::UI::TComponentUI<__VA_ARGS__> & ui, ::CeresEngine::String & name, auto& supports, auto& add, auto& remove, auto& render) noexcept
155#define CE_EDITOR_COMPONENT_ADVANCED(EditorClass) \
156 static const EditorClass CE_EDITOR_COMPONENT_TOKENPASTE2(componentUI, EditorClass) [[maybe_unused]] {}
157#define CE_EDITOR_COMPONENT_ADVANCED_BEGIN(Name, ...) struct Name##ComponentUI final : public ::CeresEngine::Editor::UI::TComponentUI<__VA_ARGS__>
158#define CE_EDITOR_COMPONENT_ADVANCED_DECL(Name) \
159 Name##ComponentUI() : TComponentUI<__VA_ARGS__>(constructor_){}; \
160 static inline const auto constructor_ = [ \
161 ](Name##ComponentUI & ui, ::CeresEngine::String & name, auto& supports, auto& add, auto& remove, auto& render) noexcept
162#define CE_EDITOR_COMPONENT_ADVANCED_END(Name) static const Name##ComponentUI CE_EDITOR_COMPONENT_TOKENPASTE2(componentUI, __COUNTER__) [[maybe_unused]]{};
#define CE_EXPLICIT(EXPR)
Definition Macros.hpp:413
Definition ComponentUI.hpp:56
void removeComponent(Entity entity) override
Removes the component from the entity.
Definition ComponentUI.hpp:73
virtual void render(C &component, Entity entity)=0
Renders a UI for the component of the given entity.
bool supports(Entity entity) const override
Checks if the given entity is supported by this component UI.
Definition ComponentUI.hpp:59
void addComponent(Entity entity) override
Adds the component to the entity.
Definition ComponentUI.hpp:70
void render(Entity entity) final
Renders a UI for the component of the given entity.
Definition ComponentUI.hpp:62
Definition ComponentUI.hpp:16
ComponentUI * previous
The previous component UI in the chain.
Definition ComponentUI.hpp:24
virtual String getName() const =0
ComponentUI * next
The next component UI in the chain.
Definition ComponentUI.hpp:21
ComponentUI()
Creates a new ComponentUI object.
virtual void removeComponent(Entity entity)=0
Removes the component from the entity.
virtual void addComponent(Entity entity)=0
Adds the component to the entity.
virtual ~ComponentUI()
Destroys the ComponentUI object.
virtual void render(Entity entity)=0
Renders a UI for the component of the given entity.
virtual bool supports(Entity entity) const =0
Checks if the given entity is supported by this component UI.
Definition ComponentUI.hpp:135
static ComponentUI * last
The last component UI in the linked list.
Definition ComponentUI.hpp:143
static ComponentUI * first
The first component UI in the linked list.
Definition ComponentUI.hpp:140
static bool anySupport(Entity entity)
static void renderUI(Entity entity)
Definition ComponentUI.hpp:76
void addComponent(const Entity entity) override
Adds the component to the entity.
Definition ComponentUI.hpp:118
void removeComponent(const Entity entity) override
Removes the component from the entity.
Definition ComponentUI.hpp:125
String getName() const final
Definition ComponentUI.hpp:132
bool supports(const Entity entity) const override
Checks if the given entity is supported by this component UI.
Definition ComponentUI.hpp:103
void render(Entity entity) override
Renders a UI for the component of the given entity.
Definition ComponentUI.hpp:111
std::function< void(Entity)> removeComponent_
Definition ComponentUI.hpp:82
std::function< void(C &, EO)> render_
Definition ComponentUI.hpp:79
std::function< bool(Entity)> supports_
Definition ComponentUI.hpp:80
String name
Definition ComponentUI.hpp:78
std::function< void(Entity)> addComponent_
Definition ComponentUI.hpp:81
The base entity class.
Definition Entity.hpp:41
AbstractComponent & get(const ComponentType &type) const
Gets a component of the given type.
E as() const
Converts the entity handle type into a E entity object.
void remove(const ComponentType &type) const
Removes a component of the given type from the entity.
bool has(const ComponentType &type) const noexcept
Checks if the entity has all components of the given type.
Definition ComponentUI.hpp:14
@ Constructor
Indicates that the item is a constructor.
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25