commit de acabar la jornada laboral

This commit is contained in:
2024-10-17 13:57:41 +02:00
parent db884cb422
commit 59de566c5b
24 changed files with 78 additions and 274 deletions

View File

@@ -16,9 +16,7 @@ std::vector<Animation> loadAnimationFromFile(std::shared_ptr<Texture> texture, s
auto frame_height = 0;
auto max_tiles = 0;
#ifdef VERBOSE
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
#endif
std::ifstream file(file_path);
std::string line;
@@ -26,9 +24,7 @@ std::vector<Animation> loadAnimationFromFile(std::shared_ptr<Texture> texture, s
if (file.good())
{
// Procesa el fichero linea a linea
#ifdef VERBOSE
std::cout << "Animation loaded: " << file_name << std::endl;
#endif
while (std::getline(file, line))
{
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
@@ -86,9 +82,7 @@ std::vector<Animation> loadAnimationFromFile(std::shared_ptr<Texture> texture, s
else
{
#ifdef VERBOSE
std::cout << "Warning: file " << file_name.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
#endif
}
}
} while (line != "[/animation]");
@@ -123,9 +117,7 @@ std::vector<Animation> loadAnimationFromFile(std::shared_ptr<Texture> texture, s
else
{
#ifdef VERBOSE
std::cout << "Warning: file " << file_name.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
#endif
}
// Normaliza valores
@@ -150,9 +142,7 @@ std::vector<Animation> loadAnimationFromFile(std::shared_ptr<Texture> texture, s
// El fichero no se puede abrir
else
{
#ifdef VERBOSE
std::cout << "Warning: Unable to open " << file_name.c_str() << " file" << std::endl;
#endif
}
return animations;
@@ -204,9 +194,7 @@ int AnimatedSprite::getIndex(const std::string &name)
return index;
}
}
#ifdef VERBOSE
std::cout << "** Warning: could not find \"" << name.c_str() << "\" animation" << std::endl;
#endif
return -1;
}
@@ -407,9 +395,7 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
else
{
#ifdef VERBOSE
std::cout << "Warning: unknown parameter " << line.substr(0, pos).c_str() << std::endl;
#endif
success = false;
}
}
@@ -445,9 +431,7 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
else
{
#ifdef VERBOSE
std::cout << "Warning: unknown parameter " << line.substr(0, pos).c_str() << std::endl;
#endif
success = false;
}
@@ -471,7 +455,7 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
}
// Pone un valor por defecto
setPos((SDL_Rect){0, 0, frame_width, frame_height});
setPosition((SDL_Rect){0, 0, frame_width, frame_height});
return success;
}