Revisada la carrega de recursos en game.cpp
This commit is contained in:
@@ -38,22 +38,17 @@ void Explosions::render()
|
||||
}
|
||||
|
||||
// Añade texturas al objeto
|
||||
void Explosions::addTexture(int size, std::shared_ptr<Texture> texture, std::vector<std::string> *animation)
|
||||
void Explosions::addTexture(int size, std::shared_ptr<Texture> texture, std::vector<std::string> &animation)
|
||||
{
|
||||
ExplosionTexture temp;
|
||||
temp.size = size;
|
||||
temp.texture = texture;
|
||||
temp.animation = animation;
|
||||
textures_.push_back(temp);
|
||||
textures_.emplace_back(ExplosionTexture(size, texture, animation));
|
||||
}
|
||||
|
||||
// Añade una explosión
|
||||
void Explosions::add(int x, int y, int size)
|
||||
{
|
||||
const int index = getIndexBySize(size);
|
||||
auto sprite = std::make_unique<AnimatedSprite>(textures_[index].texture, textures_[index].animation);
|
||||
sprite->setPos(x, y);
|
||||
explosions_.push_back(std::move(sprite));
|
||||
const auto index = getIndexBySize(size);
|
||||
explosions_.emplace_back(std::make_unique<AnimatedSprite>(textures_[index].texture, textures_[index].animation));
|
||||
explosions_.back()->setPos(x, y);
|
||||
}
|
||||
|
||||
// Vacia el vector de elementos finalizados
|
||||
|
||||
Reference in New Issue
Block a user