SDLPP: make copySelf actually copy everything
This commit is contained in:
@@ -104,4 +104,19 @@ std::shared_ptr< Renderer > RenderObject::getRenderer() const {
|
||||
void RenderObject::setSceneID( int id ) {
|
||||
scene_id = id;
|
||||
}
|
||||
void RenderObject::copyTo(std::shared_ptr<RenderObject> other) {
|
||||
other->collisions.clear();
|
||||
for ( auto &colider : collisions ) {
|
||||
other->collisions.push_back(colider->copySelf());
|
||||
}
|
||||
other->texture.reset();
|
||||
if ( texture ) {
|
||||
other->texture = std::make_shared< Texture >( *texture );
|
||||
}
|
||||
other->polygon.reset();
|
||||
if ( polygon ) {
|
||||
other->polygon = polygon->copySelf();
|
||||
}
|
||||
other->colidedWith.clear();
|
||||
}
|
||||
} // namespace SDLPP
|
||||
|
||||
Reference in New Issue
Block a user