Revisada la carrega de recursos en game.cpp
This commit is contained in:
@@ -16,18 +16,16 @@ AnimatedSprite::AnimatedSprite(std::shared_ptr<Texture> texture, const std::stri
|
||||
{
|
||||
animations_ = loadFromFile(file_path);
|
||||
}
|
||||
//setSpriteClip(animations_[current_animation_].frames[animations_[current_animation_].current_frame]);
|
||||
}
|
||||
|
||||
AnimatedSprite::AnimatedSprite(std::shared_ptr<Texture> texture, std::vector<std::string> *animations)
|
||||
AnimatedSprite::AnimatedSprite(std::shared_ptr<Texture> texture, const std::vector<std::string> &animations)
|
||||
: MovingSprite(texture),
|
||||
current_animation_(0)
|
||||
{
|
||||
if (animations)
|
||||
if (!animations.empty())
|
||||
{
|
||||
loadFromVector(animations);
|
||||
}
|
||||
//setSpriteClip(animations_[current_animation_].frames[animations_[current_animation_].current_frame]);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
@@ -179,7 +177,7 @@ SDL_Rect AnimatedSprite::getAnimationClip(int indexA, Uint8 indexF)
|
||||
}
|
||||
|
||||
// Carga la animación desde un vector
|
||||
bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
|
||||
bool AnimatedSprite::loadFromVector(const std::vector<std::string> &source)
|
||||
{
|
||||
// Inicializa variables
|
||||
auto frames_per_row = 0;
|
||||
@@ -193,10 +191,10 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
|
||||
|
||||
// Recorre todo el vector
|
||||
auto index = 0;
|
||||
while (index < (int)source->size())
|
||||
while (index < (int)source.size())
|
||||
{
|
||||
// Lee desde el vector
|
||||
line = source->at(index);
|
||||
line = source.at(index);
|
||||
|
||||
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
|
||||
if (line == "[animation]")
|
||||
@@ -214,7 +212,7 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
|
||||
{
|
||||
// Aumenta el indice para leer la siguiente linea
|
||||
index++;
|
||||
line = source->at(index);
|
||||
line = source.at(index);
|
||||
|
||||
// Encuentra la posición del caracter '='
|
||||
int pos = line.find("=");
|
||||
@@ -378,7 +376,7 @@ void AnimatedSprite::resetAnimation()
|
||||
}
|
||||
|
||||
// Carga la animación desde un fichero
|
||||
std::vector<Animation> AnimatedSprite::loadFromFile(std::string file_path)
|
||||
std::vector<Animation> AnimatedSprite::loadFromFile(const std::string &file_path)
|
||||
{
|
||||
// Inicializa variables
|
||||
std::vector<Animation> animations;
|
||||
|
||||
@@ -30,15 +30,15 @@ protected:
|
||||
void animate();
|
||||
|
||||
// Carga la animación desde un fichero
|
||||
std::vector<Animation> loadFromFile(std::string filePath);
|
||||
std::vector<Animation> loadFromFile(const std::string &file_path);
|
||||
|
||||
// Carga la animación desde un vector
|
||||
bool loadFromVector(std::vector<std::string> *source);
|
||||
bool loadFromVector(const std::vector<std::string> &source);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, const std::string &file_path);
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, std::vector<std::string> *animations);
|
||||
AnimatedSprite(std::shared_ptr<Texture> texture, const std::vector<std::string> &animations);
|
||||
explicit AnimatedSprite(std::shared_ptr<Texture> texture);
|
||||
|
||||
// Destructor
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "texture.h" // for Texture
|
||||
|
||||
// Constructor
|
||||
Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16 creation_timer, std::shared_ptr<Texture> texture, std::vector<std::string> *animation)
|
||||
Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16 creation_timer, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation)
|
||||
: sprite_(std::make_unique<AnimatedSprite>(texture, animation)),
|
||||
pos_x_(x),
|
||||
pos_y_(y),
|
||||
|
||||
@@ -141,7 +141,7 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16 creation_timer, std::shared_ptr<Texture> texture, std::vector<std::string> *animation);
|
||||
Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16 creation_timer, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation);
|
||||
|
||||
// Destructor
|
||||
~Balloon() = default;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,9 +8,13 @@ class Texture;
|
||||
|
||||
struct ExplosionTexture
|
||||
{
|
||||
std::shared_ptr<Texture> texture; // Textura para la explosión
|
||||
std::vector<std::string> *animation; // Animación para la textura
|
||||
int size; // Tamaño de la explosión
|
||||
int size; // Tamaño de la explosión
|
||||
std::shared_ptr<Texture> texture; // Textura para la explosión
|
||||
std::vector<std::string> animation; // Animación para la textura
|
||||
|
||||
// Constructor
|
||||
ExplosionTexture(int sz, std::shared_ptr<Texture> tex, std::vector<std::string> anim)
|
||||
: size(sz), texture(tex), animation(anim) {}
|
||||
};
|
||||
|
||||
// Clase explosions
|
||||
@@ -41,7 +45,7 @@ public:
|
||||
void render();
|
||||
|
||||
// Añade texturas al objeto
|
||||
void addTexture(int size, std::shared_ptr<Texture> texture, std::vector<std::string> *animation);
|
||||
void addTexture(int size, std::shared_ptr<Texture> texture, std::vector<std::string> &animation);
|
||||
|
||||
// Añade una explosión
|
||||
void add(int x, int y, int size);
|
||||
|
||||
175
source/game.cpp
175
source/game.cpp
@@ -304,15 +304,18 @@ void Game::loadMedia()
|
||||
|
||||
// Limpia
|
||||
{
|
||||
player_animations_.clear();
|
||||
balloon_animations_.clear();
|
||||
item_animations_.clear();
|
||||
player1_textures_.clear();
|
||||
player2_textures_.clear();
|
||||
item_textures_.clear();
|
||||
// Texturas
|
||||
game_text_textures_.clear();
|
||||
balloon_textures_.clear();
|
||||
explosions_textures_.clear();
|
||||
game_text_textures_.clear();
|
||||
item_textures_.clear();
|
||||
player_textures_.clear();
|
||||
|
||||
// Animaciones
|
||||
player_animations_.clear();
|
||||
balloon_animations_.clear();
|
||||
explosions_animations_.clear();
|
||||
item_animations_.clear();
|
||||
}
|
||||
|
||||
// Texturas
|
||||
@@ -358,109 +361,64 @@ void Game::loadMedia()
|
||||
|
||||
// Texturas - Player1
|
||||
{
|
||||
player1_textures_.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player1.gif")));
|
||||
player1_textures_.back()->addPalette(asset_->get("player1_pal1.gif"));
|
||||
player1_textures_.back()->addPalette(asset_->get("player1_pal2.gif"));
|
||||
player1_textures_.back()->addPalette(asset_->get("player1_pal3.gif"));
|
||||
std::vector<std::shared_ptr<Texture>> player_texture;
|
||||
player_texture.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player1.gif")));
|
||||
player_texture.back()->addPalette(asset_->get("player1_pal1.gif"));
|
||||
player_texture.back()->addPalette(asset_->get("player1_pal2.gif"));
|
||||
player_texture.back()->addPalette(asset_->get("player1_pal3.gif"));
|
||||
|
||||
player1_textures_.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player_power.gif")));
|
||||
player1_textures_.back()->addPalette(asset_->get("player_power_pal.gif"));
|
||||
player_texture.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player_power.gif")));
|
||||
player_texture.back()->addPalette(asset_->get("player_power_pal.gif"));
|
||||
|
||||
player_textures_.push_back(player1_textures_);
|
||||
player_textures_.push_back(player_texture);
|
||||
}
|
||||
|
||||
// Texturas - Player2
|
||||
{
|
||||
player2_textures_.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player2.gif")));
|
||||
player2_textures_.back()->addPalette(asset_->get("player2_pal1.gif"));
|
||||
player2_textures_.back()->addPalette(asset_->get("player2_pal2.gif"));
|
||||
player2_textures_.back()->addPalette(asset_->get("player2_pal3.gif"));
|
||||
std::vector<std::shared_ptr<Texture>> player_texture;
|
||||
player_texture.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player2.gif")));
|
||||
player_texture.back()->addPalette(asset_->get("player2_pal1.gif"));
|
||||
player_texture.back()->addPalette(asset_->get("player2_pal2.gif"));
|
||||
player_texture.back()->addPalette(asset_->get("player2_pal3.gif"));
|
||||
|
||||
player2_textures_.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player_power.gif")));
|
||||
player2_textures_.back()->addPalette(asset_->get("player_power_pal.gif"));
|
||||
player2_textures_.back()->setPalette(1);
|
||||
player_texture.emplace_back(std::make_shared<Texture>(renderer_, asset_->get("player_power.gif")));
|
||||
player_texture.back()->addPalette(asset_->get("player_power_pal.gif"));
|
||||
player_texture.back()->setPalette(1);
|
||||
|
||||
player_textures_.push_back(player2_textures_);
|
||||
player_textures_.push_back(player_texture);
|
||||
}
|
||||
|
||||
// Animaciones -- Jugador
|
||||
{
|
||||
std::vector<std::string> *player_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("player.ani"), player_animations);
|
||||
player_animations_.push_back(player_animations);
|
||||
|
||||
std::vector<std::string> *player_power_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("player_power.ani"), player_power_animations);
|
||||
player_animations_.push_back(player_power_animations);
|
||||
player_animations_.emplace_back(loadAnimations(asset_->get("player.ani")));
|
||||
player_animations_.emplace_back(loadAnimations(asset_->get("player_power.ani")));
|
||||
}
|
||||
|
||||
// Animaciones -- Globos
|
||||
{
|
||||
std::vector<std::string> *balloon1_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("balloon1.ani"), balloon1_animations);
|
||||
balloon_animations_.push_back(balloon1_animations);
|
||||
|
||||
std::vector<std::string> *balloon2_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("balloon2.ani"), balloon2_animations);
|
||||
balloon_animations_.push_back(balloon2_animations);
|
||||
|
||||
std::vector<std::string> *balloon3_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("balloon3.ani"), balloon3_animations);
|
||||
balloon_animations_.push_back(balloon3_animations);
|
||||
|
||||
std::vector<std::string> *balloon4_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("balloon4.ani"), balloon4_animations);
|
||||
balloon_animations_.push_back(balloon4_animations);
|
||||
|
||||
std::vector<std::string> *balloon5_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("powerball.ani"), balloon5_animations);
|
||||
balloon_animations_.push_back(balloon5_animations);
|
||||
balloon_animations_.emplace_back(loadAnimations(asset_->get("balloon1.ani")));
|
||||
balloon_animations_.emplace_back(loadAnimations(asset_->get("balloon2.ani")));
|
||||
balloon_animations_.emplace_back(loadAnimations(asset_->get("balloon3.ani")));
|
||||
balloon_animations_.emplace_back(loadAnimations(asset_->get("balloon4.ani")));
|
||||
balloon_animations_.emplace_back(loadAnimations(asset_->get("powerball.ani")));
|
||||
}
|
||||
|
||||
// Animaciones -- Explosiones
|
||||
{
|
||||
std::vector<std::string> *explosions1_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("explosion1.ani"), explosions1_animations);
|
||||
explosions_animations_.push_back(explosions1_animations);
|
||||
|
||||
std::vector<std::string> *explosions2_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("explosion2.ani"), explosions2_animations);
|
||||
explosions_animations_.push_back(explosions2_animations);
|
||||
|
||||
std::vector<std::string> *explosions3_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("explosion3.ani"), explosions3_animations);
|
||||
explosions_animations_.push_back(explosions3_animations);
|
||||
|
||||
std::vector<std::string> *explosions4_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("explosion4.ani"), explosions4_animations);
|
||||
explosions_animations_.push_back(explosions4_animations);
|
||||
explosions_animations_.emplace_back(loadAnimations(asset_->get("explosion1.ani")));
|
||||
explosions_animations_.emplace_back(loadAnimations(asset_->get("explosion2.ani")));
|
||||
explosions_animations_.emplace_back(loadAnimations(asset_->get("explosion3.ani")));
|
||||
explosions_animations_.emplace_back(loadAnimations(asset_->get("explosion4.ani")));
|
||||
}
|
||||
|
||||
// Animaciones -- Items
|
||||
{
|
||||
std::vector<std::string> *item1_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("item_points1_disk.ani"), item1_animations);
|
||||
item_animations_.push_back(item1_animations);
|
||||
|
||||
std::vector<std::string> *item2_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("item_points2_gavina.ani"), item2_animations);
|
||||
item_animations_.push_back(item2_animations);
|
||||
|
||||
std::vector<std::string> *item3_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("item_points3_pacmar.ani"), item3_animations);
|
||||
item_animations_.push_back(item3_animations);
|
||||
|
||||
std::vector<std::string> *item4_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("item_clock.ani"), item4_animations);
|
||||
item_animations_.push_back(item4_animations);
|
||||
|
||||
std::vector<std::string> *item5_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("item_coffee.ani"), item5_animations);
|
||||
item_animations_.push_back(item5_animations);
|
||||
|
||||
std::vector<std::string> *item6_animations = new std::vector<std::string>;
|
||||
loadAnimations(asset_->get("item_coffee_machine.ani"), item6_animations);
|
||||
item_animations_.push_back(item6_animations);
|
||||
item_animations_.emplace_back(loadAnimations(asset_->get("item_points1_disk.ani")));
|
||||
item_animations_.emplace_back(loadAnimations(asset_->get("item_points2_gavina.ani")));
|
||||
item_animations_.emplace_back(loadAnimations(asset_->get("item_points3_pacmar.ani")));
|
||||
item_animations_.emplace_back(loadAnimations(asset_->get("item_clock.ani")));
|
||||
item_animations_.emplace_back(loadAnimations(asset_->get("item_coffee.ani")));
|
||||
item_animations_.emplace_back(loadAnimations(asset_->get("item_coffee_machine.ani")));
|
||||
}
|
||||
|
||||
// Texto
|
||||
@@ -498,11 +456,11 @@ void Game::loadMedia()
|
||||
void Game::unloadMedia()
|
||||
{
|
||||
// Texturas
|
||||
player1_textures_.clear();
|
||||
player2_textures_.clear();
|
||||
item_textures_.clear();
|
||||
game_text_textures_.clear();
|
||||
balloon_textures_.clear();
|
||||
explosions_textures_.clear();
|
||||
item_textures_.clear();
|
||||
player_textures_.clear();
|
||||
|
||||
// Animaciones
|
||||
player_animations_.clear();
|
||||
@@ -2158,21 +2116,24 @@ void Game::checkEvents()
|
||||
}
|
||||
|
||||
// Carga las animaciones
|
||||
void Game::loadAnimations(std::string filePath, std::vector<std::string> *buffer)
|
||||
std::vector<std::string> Game::loadAnimations(const std::string &file_path)
|
||||
{
|
||||
std::ifstream file(filePath);
|
||||
std::string line;
|
||||
|
||||
if (file)
|
||||
std::vector<std::string> buffer;
|
||||
std::ifstream file(file_path);
|
||||
if (!file)
|
||||
{
|
||||
|
||||
std::cout << "Animation loaded: " << filePath.substr(filePath.find_last_of("\\/") + 1).c_str() << std::endl;
|
||||
while (std::getline(file, line))
|
||||
{
|
||||
buffer->push_back(line);
|
||||
}
|
||||
file.close();
|
||||
std::cerr << "Error: no se pudo abrir el archivo " << file_path << std::endl;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::string line;
|
||||
std::cout << "Animation loaded: " << file_path.substr(file_path.find_last_of("\\/") + 1) << std::endl;
|
||||
while (std::getline(file, line))
|
||||
{
|
||||
buffer.push_back(line);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Elimina todos los objetos contenidos en vectores
|
||||
@@ -2198,14 +2159,12 @@ void Game::reloadTextures()
|
||||
texture->reLoad();
|
||||
}
|
||||
|
||||
for (auto &texture : player1_textures_)
|
||||
for (auto &textures : player_textures_)
|
||||
{
|
||||
texture->reLoad();
|
||||
}
|
||||
|
||||
for (auto &texture : player2_textures_)
|
||||
{
|
||||
texture->reLoad();
|
||||
for (auto &texture : textures)
|
||||
{
|
||||
texture->reLoad();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &texture : game_text_textures_)
|
||||
|
||||
@@ -129,17 +129,14 @@ private:
|
||||
std::vector<std::shared_ptr<Texture>> item_textures_; // Vector con las texturas de los items
|
||||
std::vector<std::shared_ptr<Texture>> balloon_textures_; // Vector con las texturas de los globos
|
||||
std::vector<std::shared_ptr<Texture>> explosions_textures_; // Vector con las texturas de las explosiones
|
||||
std::vector<std::shared_ptr<Texture>> player1_textures_; // Vector con las texturas del jugador
|
||||
std::vector<std::shared_ptr<Texture>> player2_textures_; // Vector con las texturas del jugador
|
||||
std::vector<std::vector<std::shared_ptr<Texture>>> player_textures_; // Vector con todas las texturas de los jugadores;
|
||||
|
||||
std::vector<std::shared_ptr<Texture>> game_text_textures_; // Vector con las texturas para los sprites con textos
|
||||
// std::vector<std::shared_ptr<SpriteSmart>> game_text_sprites_; // Sprite con el textos que aparecen al coger items
|
||||
|
||||
std::vector<std::vector<std::string> *> item_animations_; // Vector con las animaciones de los items
|
||||
std::vector<std::vector<std::string> *> player_animations_; // Vector con las animaciones del jugador
|
||||
std::vector<std::vector<std::string> *> balloon_animations_; // Vector con las animaciones de los globos
|
||||
std::vector<std::vector<std::string> *> explosions_animations_; // Vector con las animaciones de las explosiones
|
||||
std::vector<std::vector<std::string>> item_animations_; // Vector con las animaciones de los items
|
||||
std::vector<std::vector<std::string>> player_animations_; // Vector con las animaciones del jugador
|
||||
std::vector<std::vector<std::string>> balloon_animations_; // Vector con las animaciones de los globos
|
||||
std::vector<std::vector<std::string>> explosions_animations_; // Vector con las animaciones de las explosiones
|
||||
|
||||
std::unique_ptr<Text> text_; // Fuente para los textos del juego
|
||||
std::unique_ptr<Text> text_big_; // Fuente de texto grande
|
||||
@@ -403,7 +400,7 @@ private:
|
||||
bool allPlayersAreNotPlaying();
|
||||
|
||||
// Carga las animaciones
|
||||
void loadAnimations(std::string file_path, std::vector<std::string> *buffer);
|
||||
std::vector<std::string> loadAnimations(const std::string &file_path);
|
||||
|
||||
// Elimina todos los objetos contenidos en vectores
|
||||
void deleteAllVectorObjects();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
class Texture;
|
||||
|
||||
// Constructor
|
||||
Item::Item(ItemType type, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, std::vector<std::string> *animation)
|
||||
Item::Item(ItemType type, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation)
|
||||
: sprite_(std::make_unique<AnimatedSprite>(texture, animation)),
|
||||
accel_x_(0.0f),
|
||||
floor_collision_(false),
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Item(ItemType type, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, std::vector<std::string> *animation);
|
||||
Item(ItemType type, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation);
|
||||
|
||||
// Destructor
|
||||
~Item() = default;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "options.h"
|
||||
|
||||
// Constructor
|
||||
Player::Player(int id, float x, int y, bool demo, SDL_Rect *play_area, std::vector<std::shared_ptr<Texture>> texture, std::vector<std::vector<std::string> *> animations)
|
||||
Player::Player(int id, float x, int y, bool demo, SDL_Rect *play_area, std::vector<std::shared_ptr<Texture>> texture, const std::vector<std::vector<std::string>> &animations)
|
||||
: player_sprite_(std::make_unique<AnimatedSprite>(texture[0], animations[0])),
|
||||
power_sprite_(std::make_unique<AnimatedSprite>(texture[1], animations[1])),
|
||||
enter_name_(std::make_unique<EnterName>()),
|
||||
|
||||
@@ -113,7 +113,7 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Player(int id, float x, int y, bool demo, SDL_Rect *play_area, std::vector<std::shared_ptr<Texture>> texture, std::vector<std::vector<std::string> *> animations);
|
||||
Player(int id, float x, int y, bool demo, SDL_Rect *play_area, std::vector<std::shared_ptr<Texture>> texture, const std::vector<std::vector<std::string>> &animations);
|
||||
|
||||
// Destructor
|
||||
~Player() = default;
|
||||
|
||||
Reference in New Issue
Block a user