Asteroid::Asteroid(Game::Handle<Entity> p, const AsteroidSetup &s):
Hittable(p, s.hittable, s.physical),
setup(s),
- mesh(*this, setup.mesh)
+ mesh(this, setup.mesh)
{ }
Bullet::Bullet(Game::Handle<Game::Entity> p, const Setup &s, const Game::TransformValues &tv):
Hittable(p, s.hittable, s.physical, tv),
- mesh(*this, s.mesh)
+ mesh(this, s.mesh)
{ }
PhysicalEntity(p, ps, tv)
{
if(!setup.immortal)
- hits = Game::Owned<HitPoints>(*this, setup.hits);
+ hits = Game::Owned<HitPoints>(this, setup.hits);
if(setup.damaging)
- damage = Game::Owned<DamageSource>(*this, setup.damage);
+ damage = Game::Owned<DamageSource>(this, setup.damage);
}
PhysicalEntity::PhysicalEntity(Game::Handle<Game::Entity> p, const Setup &s, const Game::TransformValues &tv):
Entity(p, tv),
- collider(*this, s.collider)
+ collider(this, s.collider)
{
if(!s.fixture)
- body = Game::Owned<RigidBody>(*this, s.body);
+ body = Game::Owned<RigidBody>(this, s.body);
}
Playfield::Border::Border(Playfield &f, LinAl::Vector<float, 2> p, LinAl::Vector<float, 2> s):
setup{ .fixture=true, .body={}, .collider={ .type=ColliderType::BOX, .size=s }},
- entity(f, setup, compose(p, 0.0f))
+ entity(&f, setup, compose(p, 0.0f))
{ }
Ship::Ship(Game::Handle<Game::Entity> p, const Setup &s):
PhysicalEntity(p, s.physical),
setup(s),
- mesh(*this, s.mesh)
+ mesh(this, s.mesh)
{ }
Entity::Entity(Handle<Entity> p, const TransformValues &tv):
parent(p),
- transform(*this)
+ transform(this)
{
transform->set_values(tv);
}
Owned(Handle<P>, Args &&...);
template<typename P, typename... Args>
- Owned(Owned<P> &p, Args &&... a): Owned(static_cast<Handle<P> &>(p), std::forward<Args>(a)...) { }
-
- template<typename P, typename... Args>
- requires(!std::is_const_v<P>)
- Owned(P &parent, Args &&... args): Owned(Handle<P>::from_object(&parent), std::forward<Args>(args)...) { }
+ Owned(P *parent, Args &&... args): Owned(Handle<P>::from_object(parent), std::forward<Args>(args)...) { }
Owned(Owned &&other): Handle<T>(other) { other.ptr = nullptr; }
Owned &operator=(Owned &&other);