- CompositeInstance &GetModel() noexcept { return model; }
- const CompositeInstance &GetModel() const noexcept { return model; }
+ // note that when copying an entity which owns its controller, the
+ // original must outlive the copy, otherwise the copy ends up with
+ // an invalid controller pointer
+ Entity(const Entity &) noexcept;
+ Entity &operator =(const Entity &) = delete;
+
+ bool HasController() const noexcept { return ctrl; }
+ // entity takes over ownership of controller
+ void SetController(EntityController *c) noexcept;
+ // entity uses shared controller
+ void SetController(EntityController &c) noexcept;
+ void UnsetController() noexcept;
+ EntityController &GetController() noexcept { return *ctrl; }
+ const EntityController &GetController() const noexcept { return *ctrl; }
+
+ Instance &GetModel() noexcept { return model; }
+ const Instance &GetModel() const noexcept { return model; }
+
+ std::uint32_t ID() const noexcept { return id; }
+ void ID(std::uint32_t i) noexcept { id = i; }