Precàrrega de tots els recursos al inici del joc
8.000.000 de cherrypickings que he anat fent pel codi
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "asset.h"
|
||||
#include "utils.h"
|
||||
#include <SDL2/SDL_rwops.h> // for SDL_RWFromFile, SDL_RWclose, SDL_RWops
|
||||
#include <SDL2/SDL_stdinc.h> // for SDL_max
|
||||
#include <stddef.h> // for size_t
|
||||
@@ -68,10 +69,10 @@ bool Asset::check() const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
std::cout << "\n** Checking files" << std::endl;
|
||||
std::cout << "\n** CHECKING FILES" << std::endl;
|
||||
|
||||
std::cout << "Executable path is: " << executable_path_ << std::endl;
|
||||
std::cout << "Sample filepath: " << file_list_.back().file << std::endl;
|
||||
// std::cout << "Executable path is: " << executable_path_ << std::endl;
|
||||
// std::cout << "Sample filepath: " << file_list_.back().file << std::endl;
|
||||
|
||||
// Comprueba la lista de ficheros clasificandolos por tipo
|
||||
for (int type = 0; type < static_cast<int>(AssetType::MAX_ASSET_TYPE); ++type)
|
||||
@@ -99,11 +100,13 @@ bool Asset::check() const
|
||||
success &= checkFile(f.file);
|
||||
}
|
||||
}
|
||||
if (success)
|
||||
std::cout << " All files are OK." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Resultado
|
||||
std::cout << (success ? "\n** All files OK.\n" : "\n** A file is missing. Exiting.\n") << std::endl;
|
||||
std::cout << (success ? "\n** CHECKING FILES COMPLETED.\n" : "\n** CHECKING FILES FAILED.\n") << std::endl;
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -123,12 +126,8 @@ bool Asset::checkFile(const std::string &path) const
|
||||
}
|
||||
|
||||
const std::string file_name = path.substr(path.find_last_of("\\/") + 1);
|
||||
std::cout.setf(std::ios::left, std::ios::adjustfield);
|
||||
std::cout << "Checking file: ";
|
||||
std::cout.width(longest_name_ + 2);
|
||||
std::cout.fill('.');
|
||||
std::cout << file_name;
|
||||
std::cout << (success ? " [OK]" : " [ERROR]") << std::endl;
|
||||
if (!success)
|
||||
printWithDots("Checking file : ", file_name, (success ? " [ OK ]" : " [ ERROR ]"));
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user