Actualizado animatedsprite.cpp

This commit is contained in:
2022-10-20 09:18:18 +02:00
parent 4f1a596e46
commit 7ab81eaf29
2 changed files with 13 additions and 2 deletions

View File

@@ -88,6 +88,12 @@ void AnimatedSprite::animate()
}
}
// Obtiene el numero de frames de la animación actual
int AnimatedSprite::getNumFrames()
{
return (int)animation.at(currentAnimation).frames.size();
}
// Establece el frame actual de la animación
void AnimatedSprite::setCurrentFrame(int num)
{
@@ -304,7 +310,7 @@ bool AnimatedSprite::loadFromFile(std::string filePath)
}
// Pone un valor por defecto
setPos({0, 0, frameWidth, frameHeight});
setRect({0, 0, frameWidth, frameHeight});
return success;
}
@@ -442,7 +448,7 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
}
// Pone un valor por defecto
setPos({0, 0, frameWidth, frameHeight});
setRect({0, 0, frameWidth, frameHeight});
return success;
}