Segmentation fault

This commit is contained in:
2023-05-07 18:08:36 +02:00
parent 90ebea4807
commit c1f8e16963
17 changed files with 163 additions and 73 deletions

View File

@@ -148,6 +148,7 @@ animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath, b
// Constructor
AnimatedSprite::AnimatedSprite(Texture *texture, SDL_Renderer *renderer, std::string file, std::vector<std::string> *buffer)
{
//std::cout << "Creado AnimatedSprite" << std::endl;
// Copia los punteros
setTexture(texture);
setRenderer(renderer);
@@ -176,6 +177,7 @@ AnimatedSprite::AnimatedSprite(Texture *texture, SDL_Renderer *renderer, std::st
// Constructor
AnimatedSprite::AnimatedSprite(SDL_Renderer *renderer, animatedSprite_t *animation)
{
//std::cout << "Creado AnimatedSprite" << std::endl;
// Copia los punteros
setTexture(animation->texture);
setRenderer(renderer);
@@ -193,6 +195,7 @@ AnimatedSprite::AnimatedSprite(SDL_Renderer *renderer, animatedSprite_t *animati
// Destructor
AnimatedSprite::~AnimatedSprite()
{
//std::cout << "Destruido AnimatedSprite" << std::endl;
for (auto &a : animation)
{
a.frames.clear();
@@ -510,21 +513,6 @@ void AnimatedSprite::update()
MovingSprite::update();
}
// Establece el rectangulo para un frame de una animación
void AnimatedSprite::setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h)
{
animation[index_animation].frames.push_back({x, y, w, h});
}
// OLD - Establece el contador para todas las animaciones
void AnimatedSprite::setAnimationCounter(int value)
{
for (auto &a : animation)
{
a.counter = value;
}
}
// Reinicia la animación
void AnimatedSprite::resetAnimation()
{