treballant en arreglas els includes de SDL3
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#include "animated_sprite.h"
|
||||
#include <SDL3/SDL_log.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError
|
||||
#include <stddef.h> // Para size_t
|
||||
#include <fstream> // Para basic_istream, basic_ifstream, basic_ios
|
||||
#include <sstream> // Para basic_stringstream
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include "texture.h" // Para Texture
|
||||
#include "utils.h" // Para printWithDots
|
||||
#include <SDL3/SDL.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError
|
||||
#include <stddef.h> // Para size_t
|
||||
#include <fstream> // Para basic_istream, basic_ifstream, basic_ios
|
||||
#include <sstream> // Para basic_stringstream
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include "texture.h" // Para Texture
|
||||
#include "utils.h" // Para printWithDots
|
||||
|
||||
// Carga las animaciones en un vector(Animations) desde un fichero
|
||||
AnimationsFileBuffer loadAnimationsFromFile(const std::string &file_path)
|
||||
@@ -55,19 +55,18 @@ AnimatedSprite::AnimatedSprite(std::shared_ptr<Texture> texture, const Animation
|
||||
// Obtiene el índice de la animación a partir del nombre
|
||||
int AnimatedSprite::getIndex(const std::string &name)
|
||||
{
|
||||
auto it = animation_indices_.find(name);
|
||||
auto it = animation_indices_.find(name);
|
||||
if (it != animation_indices_.end())
|
||||
{
|
||||
// Si se encuentra la animación en el mapa, devuelve su índice
|
||||
return it->second;
|
||||
}
|
||||
|
||||
// Si no se encuentra, muestra una advertencia y devuelve -1
|
||||
// Si no se encuentra, muestra una advertencia y devuelve -1
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "** Warning: could not find \"%s\" animation", name.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Calcula el frame correspondiente a la animación
|
||||
void AnimatedSprite::animate()
|
||||
{
|
||||
@@ -258,7 +257,7 @@ void AnimatedSprite::loadFromAnimationsFileBuffer(const AnimationsFileBuffer &so
|
||||
animations_.emplace_back(animation);
|
||||
|
||||
// Rellena el mapa con el nombre y el nuevo índice
|
||||
animation_indices_[animation.name] = animations_.size() - 1;
|
||||
animation_indices_[animation.name] = animations_.size() - 1;
|
||||
}
|
||||
|
||||
// Una vez procesada la línea, aumenta el índice para pasar a la siguiente
|
||||
|
||||
Reference in New Issue
Block a user