36 std::vector<std::weak_ptr<component>> _components;
40 std::array<float, 4> _transformation_matrix;
69 void update_angle(
component& instance)
const;
77 template <void (
entity::*... updater)(
component&)
const>
void update() {
80 components().begin(), components().end(),
81 [&](std::weak_ptr<component>
const&
component) ->
bool {
82 std::shared_ptr<class component> locked;
86 ((this->*updater)(*locked), ...);
102 [[nodiscard]]
virtual std::vector<std::weak_ptr<component>>
const&
111 [[nodiscard]]
virtual std::vector<std::weak_ptr<component>>& components();
119 [[nodiscard]]
virtual float x()
const;
127 void set_x(
float x)
override;
135 [[nodiscard]]
virtual float y()
const;
143 void set_y(
float y)
override;
151 [[nodiscard]]
virtual float angle()
const;
159 void set_angle(
float angle)
override;
167 [[nodiscard]]
virtual std::array<float, 4>
const&
168 transformation_matrix()
const;
176 [[nodiscard]]
float x_offset()
const override;
184 virtual void set_x_offset(
float x_offset);
192 [[nodiscard]]
float y_offset()
const override;
200 virtual void set_y_offset(
float y_offset);
208 [[nodiscard]]
float angle_offset()
const override;
216 virtual void set_angle_offset(
float angle_offset);
224 [[nodiscard]]
bool attach_x()
const override;
232 virtual void set_attach_x(
bool attach_x);
240 [[nodiscard]]
bool attach_y()
const override;
248 virtual void set_attach_y(
bool attach_y);
256 [[nodiscard]]
bool attach_angle()
const override;
264 virtual void set_attach_angle(
bool attach_angle);
272 [[nodiscard]]
bool x_angle_lock()
const override;
280 virtual void set_x_angle_lock(
bool x_angle_lock);
288 [[nodiscard]]
bool y_angle_lock()
const override;
296 virtual void set_y_angle_lock(
bool y_angle_lock);
316 std::vector<std::weak_ptr<component>>
const& components = {},
317 float x = 0,
float y = 0,
float angle = 0,
float x_offset = 0,
318 float y_offset = 0,
float angle_offset = 0,
bool attach_x =
true,
319 bool attach_y =
true,
bool attach_angle =
true,
320 bool x_angle_lock =
true,
bool y_angle_lock =
true);
328 virtual void recompose();