migrant .ani a .yaml
This commit is contained in:
@@ -148,12 +148,12 @@ auto Cache::getText(const std::string& name) -> std::shared_ptr<Text> {
|
||||
throw std::runtime_error("Texto no encontrado: " + name);
|
||||
}
|
||||
|
||||
// Obtiene la animación a partir de un nombre
|
||||
auto Cache::getAnimations(const std::string& name) -> SurfaceAnimatedSprite::Animations& {
|
||||
// Obtiene los datos de animación parseados a partir de un nombre
|
||||
auto Cache::getAnimationData(const std::string& name) -> const ResourceAnimation& {
|
||||
auto it = std::ranges::find_if(animations_, [&name](const auto& a) { return a.name == name; });
|
||||
|
||||
if (it != animations_.end()) {
|
||||
return it->animation;
|
||||
return *it;
|
||||
}
|
||||
|
||||
std::cerr << "Error: Animación no encontrada " << name << '\n';
|
||||
@@ -300,7 +300,14 @@ void Cache::loadAnimations() {
|
||||
|
||||
for (const auto& l : list) {
|
||||
auto name = getFileName(l);
|
||||
animations_.emplace_back(name, SurfaceAnimatedSprite::loadAnimationsFromFile(l));
|
||||
|
||||
// Parsear YAML y almacenar datos pre-cargados
|
||||
std::shared_ptr<Surface> surface;
|
||||
float frame_width = 0.0F;
|
||||
float frame_height = 0.0F;
|
||||
auto animation_data = SurfaceAnimatedSprite::loadAnimationsFromYAML(l, surface, frame_width, frame_height);
|
||||
|
||||
animations_.emplace_back(name, animation_data, surface, frame_width, frame_height);
|
||||
updateLoadingProgress();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user