5 #include <chaiscript/chaiscript.hpp>
47 virtual bool onUpdate(
const double delta) = 0;
66 std::shared_ptr<Transform>
getTransform() const noexcept;
86 unsigned int getId() const noexcept;
92 virtual std::
string to_string() const noexcept;
98 virtual std::
string className() const noexcept;
115 bool operator<(
Component& other) noexcept;
117 virtual
void onNotifyNow(std::shared_ptr<Events::Event> event) override;
120 virtual
void log(el::base::type::ostream_t& os) const override;
unsigned int getId() const noexcept
Gets the identifier.
Definition: component.cpp:55
virtual void log(el::base::type::ostream_t &os) const override
Definition: component.cpp:73
Class for component manager.
Definition: component_manager.h:14
unsigned int id
Definition: component.h:25
Base Class for all components.
Definition: component.h:20
std::weak_ptr< Entity > entity
Definition: component.h:22
static unsigned int next_id
Definition: component.h:27
Class for a subject that an observer would observe for changes.
Definition: subject.h:13
void setTransform(std::shared_ptr< Transform > transform)
Sets the transform.
Definition: component.cpp:39
void setActive(const bool active) noexcept
Sets the component active or inactive.
Definition: component.cpp:47
Interface to be notified of an item's changes.
Definition: observer.h:13
bool active
Definition: component.h:24
Class for entity in the engine.
Definition: entity.h:15
std::shared_ptr< Transform > getTransform() const noexcept
Gets the transform.
Definition: component.cpp:43
std::shared_ptr< Transform > transform
Definition: component.h:23
virtual void onDestroy()=0
Called when the engine is shutting down.
virtual void handleQueuedEvent(std::shared_ptr< Events::Event > event) override
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received...
Definition: component.cpp:16
virtual unsigned long long getValueForSorting() const =0
Gets the value for sorting.
bool isActive() const noexcept
Determines if active.
Definition: component.cpp:51
virtual std::string to_string() const noexcept
Returns a string representation of the object.
Definition: component.cpp:63
Component()
Component constructor.
Definition: component.cpp:11
virtual bool onUpdate(const double delta)=0
Called every engine loop.
virtual void onStart()=0
Called when the engine starts and when a new scene is loaded.
virtual void onNotifyNow(std::shared_ptr< Events::Event > event) override
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure ...
Definition: component.cpp:35
virtual std::string className() const noexcept
Returns a string representing the class name.
Definition: component.cpp:69