corregit: no trobava version.h
This commit is contained in:
@@ -124,7 +124,8 @@ add_executable(${PROJECT_NAME} ${APP_SOURCES} ${EXTERNAL_SOURCES})
|
||||
# --- 3. DIRECTORIOS DE INCLUSIÓN ---
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/source"
|
||||
"${CMAKE_SOURCE_DIR}/source/external"
|
||||
"${CMAKE_SOURCE_DIR}/source/external"
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
)
|
||||
|
||||
# Enlazar la librería SDL3
|
||||
|
||||
@@ -10,22 +10,22 @@
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <utility> // Para move
|
||||
|
||||
#include "asset.h" // Para Asset
|
||||
#include "color.h" // Para Color
|
||||
#include "version.h" // Para Version::APP_NAME y Version::GIT_HASH
|
||||
#include "asset.h" // Para Asset
|
||||
#include "color.h" // Para Color
|
||||
#include "external/jail_audio.h" // Para JA_LoadMusic, JA_LoadSound, JA_DeleteMusic, JA_DeleteSound
|
||||
#include "lang.h" // Para getText
|
||||
#include "param.h" // Para Param, param, ParamResource, ParamGame
|
||||
#include "resource_helper.h" // Para ResourceHelper
|
||||
#include "screen.h" // Para Screen
|
||||
#include "text.h" // Para Text
|
||||
#include "lang.h" // Para getText
|
||||
#include "param.h" // Para Param, param, ParamResource, ParamGame
|
||||
#include "resource_helper.h" // Para ResourceHelper
|
||||
#include "screen.h" // Para Screen
|
||||
#include "text.h" // Para Text
|
||||
#include "version.h" // Para Version::APP_NAME y Version::GIT_HASH
|
||||
|
||||
struct JA_Music_t; // lines 11-11
|
||||
struct JA_Sound_t; // lines 12-12
|
||||
|
||||
// Helper para cargar archivos de audio desde pack o filesystem
|
||||
namespace {
|
||||
std::string createTempAudioFile(const std::string &file_path, std::vector<std::string> &temp_files_tracker) {
|
||||
std::string createTempAudioFile(const std::string& file_path, std::vector<std::string>& temp_files_tracker) {
|
||||
auto resource_data = ResourceHelper::loadFile(file_path);
|
||||
if (!resource_data.empty()) {
|
||||
// Crear archivo temporal
|
||||
@@ -41,7 +41,7 @@ std::string createTempAudioFile(const std::string &file_path, std::vector<std::s
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: Cannot create temp file %s", temp_path.c_str());
|
||||
return file_path;
|
||||
}
|
||||
temp_file.write(reinterpret_cast<const char *>(resource_data.data()), resource_data.size());
|
||||
temp_file.write(reinterpret_cast<const char*>(resource_data.data()), resource_data.size());
|
||||
temp_file.close();
|
||||
|
||||
// Agregar a la lista de archivos temporales para limpieza posterior
|
||||
@@ -56,7 +56,7 @@ std::string createTempAudioFile(const std::string &file_path, std::vector<std::s
|
||||
// Declaraciones de funciones que necesitas implementar en otros archivos
|
||||
|
||||
// Singleton
|
||||
Resource *Resource::instance = nullptr;
|
||||
Resource* Resource::instance = nullptr;
|
||||
|
||||
// Inicializa la instancia única del singleton con modo de carga
|
||||
void Resource::init(LoadingMode mode) {
|
||||
@@ -70,7 +70,7 @@ void Resource::destroy() {
|
||||
}
|
||||
|
||||
// Obtiene la instancia
|
||||
auto Resource::get() -> Resource * { return Resource::instance; }
|
||||
auto Resource::get() -> Resource* { return Resource::instance; }
|
||||
|
||||
// Constructor con modo de carga
|
||||
Resource::Resource(LoadingMode mode)
|
||||
@@ -111,10 +111,10 @@ void Resource::loadTextFilesQuiet() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> TEXT FILES (quiet load)");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::FONT);
|
||||
|
||||
for (const auto &l : list) {
|
||||
for (const auto& l : list) {
|
||||
auto name = getFileName(l);
|
||||
// Buscar en nuestra lista y cargar directamente
|
||||
auto it = std::ranges::find_if(text_files_, [&name](const auto &t) { return t.name == name; });
|
||||
auto it = std::ranges::find_if(text_files_, [&name](const auto& t) { return t.name == name; });
|
||||
if (it != text_files_.end()) {
|
||||
it->text_file = Text::loadFile(l);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Text file loaded: %s", name.c_str());
|
||||
@@ -140,12 +140,12 @@ void Resource::loadEssentialTextures() {
|
||||
|
||||
auto texture_list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
|
||||
for (const auto &file : texture_list) {
|
||||
for (const auto& file : texture_list) {
|
||||
auto name = getFileName(file);
|
||||
// Solo cargar texturas esenciales
|
||||
if (std::ranges::find(ESSENTIAL_TEXTURES, name) != ESSENTIAL_TEXTURES.end()) {
|
||||
// Buscar en nuestra lista y cargar
|
||||
auto it = std::ranges::find_if(textures_, [&name](const auto &t) { return t.name == name; });
|
||||
auto it = std::ranges::find_if(textures_, [&name](const auto& t) { return t.name == name; });
|
||||
if (it != textures_.end()) {
|
||||
it->texture = std::make_shared<Texture>(Screen::get()->getRenderer(), file);
|
||||
}
|
||||
@@ -160,35 +160,35 @@ void Resource::initResourceLists() {
|
||||
// Inicializa lista de sonidos
|
||||
auto sound_list = Asset::get()->getListByType(Asset::Type::SOUND);
|
||||
sounds_.clear();
|
||||
for (const auto &file : sound_list) {
|
||||
for (const auto& file : sound_list) {
|
||||
sounds_.emplace_back(getFileName(file));
|
||||
}
|
||||
|
||||
// Inicializa lista de músicas
|
||||
auto music_list = Asset::get()->getListByType(Asset::Type::MUSIC);
|
||||
musics_.clear();
|
||||
for (const auto &file : music_list) {
|
||||
for (const auto& file : music_list) {
|
||||
musics_.emplace_back(getFileName(file));
|
||||
}
|
||||
|
||||
// Inicializa lista de texturas
|
||||
auto texture_list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
textures_.clear();
|
||||
for (const auto &file : texture_list) {
|
||||
for (const auto& file : texture_list) {
|
||||
textures_.emplace_back(getFileName(file));
|
||||
}
|
||||
|
||||
// Inicializa lista de ficheros de texto
|
||||
auto text_file_list = Asset::get()->getListByType(Asset::Type::FONT);
|
||||
text_files_.clear();
|
||||
for (const auto &file : text_file_list) {
|
||||
for (const auto& file : text_file_list) {
|
||||
text_files_.emplace_back(getFileName(file));
|
||||
}
|
||||
|
||||
// Inicializa lista de animaciones
|
||||
auto animation_list = Asset::get()->getListByType(Asset::Type::ANIMATION);
|
||||
animations_.clear();
|
||||
for (const auto &file : animation_list) {
|
||||
for (const auto& file : animation_list) {
|
||||
animations_.emplace_back(getFileName(file));
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ void Resource::initResourceLists() {
|
||||
"smb2_grad"};
|
||||
|
||||
texts_.clear();
|
||||
for (const auto &text_name : TEXT_OBJECTS) {
|
||||
for (const auto& text_name : TEXT_OBJECTS) {
|
||||
texts_.emplace_back(text_name); // Constructor con nullptr por defecto
|
||||
}
|
||||
|
||||
@@ -219,8 +219,8 @@ void Resource::initResourceLists() {
|
||||
}
|
||||
|
||||
// Obtiene el sonido a partir de un nombre (con carga perezosa)
|
||||
auto Resource::getSound(const std::string &name) -> JA_Sound_t * {
|
||||
auto it = std::ranges::find_if(sounds_, [&name](const auto &s) { return s.name == name; });
|
||||
auto Resource::getSound(const std::string& name) -> JA_Sound_t* {
|
||||
auto it = std::ranges::find_if(sounds_, [&name](const auto& s) { return s.name == name; });
|
||||
|
||||
if (it != sounds_.end()) {
|
||||
// Si está en modo lazy y no se ha cargado aún, lo carga ahora
|
||||
@@ -235,8 +235,8 @@ auto Resource::getSound(const std::string &name) -> JA_Sound_t * {
|
||||
}
|
||||
|
||||
// Obtiene la música a partir de un nombre (con carga perezosa)
|
||||
auto Resource::getMusic(const std::string &name) -> JA_Music_t * {
|
||||
auto it = std::ranges::find_if(musics_, [&name](const auto &m) { return m.name == name; });
|
||||
auto Resource::getMusic(const std::string& name) -> JA_Music_t* {
|
||||
auto it = std::ranges::find_if(musics_, [&name](const auto& m) { return m.name == name; });
|
||||
|
||||
if (it != musics_.end()) {
|
||||
// Si está en modo lazy y no se ha cargado aún, lo carga ahora
|
||||
@@ -251,8 +251,8 @@ auto Resource::getMusic(const std::string &name) -> JA_Music_t * {
|
||||
}
|
||||
|
||||
// Obtiene la textura a partir de un nombre (con carga perezosa)
|
||||
auto Resource::getTexture(const std::string &name) -> std::shared_ptr<Texture> {
|
||||
auto it = std::ranges::find_if(textures_, [&name](const auto &t) { return t.name == name; });
|
||||
auto Resource::getTexture(const std::string& name) -> std::shared_ptr<Texture> {
|
||||
auto it = std::ranges::find_if(textures_, [&name](const auto& t) { return t.name == name; });
|
||||
|
||||
if (it != textures_.end()) {
|
||||
// Si está en modo lazy y no se ha cargado aún, lo carga ahora
|
||||
@@ -267,8 +267,8 @@ auto Resource::getTexture(const std::string &name) -> std::shared_ptr<Texture> {
|
||||
}
|
||||
|
||||
// Obtiene el fichero de texto a partir de un nombre (con carga perezosa)
|
||||
auto Resource::getTextFile(const std::string &name) -> std::shared_ptr<Text::File> {
|
||||
auto it = std::ranges::find_if(text_files_, [&name](const auto &t) { return t.name == name; });
|
||||
auto Resource::getTextFile(const std::string& name) -> std::shared_ptr<Text::File> {
|
||||
auto it = std::ranges::find_if(text_files_, [&name](const auto& t) { return t.name == name; });
|
||||
|
||||
if (it != text_files_.end()) {
|
||||
// Si está en modo lazy y no se ha cargado aún, lo carga ahora
|
||||
@@ -283,8 +283,8 @@ auto Resource::getTextFile(const std::string &name) -> std::shared_ptr<Text::Fil
|
||||
}
|
||||
|
||||
// Obtiene el objeto de texto a partir de un nombre (con carga perezosa)
|
||||
auto Resource::getText(const std::string &name) -> std::shared_ptr<Text> {
|
||||
auto it = std::ranges::find_if(texts_, [&name](const auto &t) { return t.name == name; });
|
||||
auto Resource::getText(const std::string& name) -> std::shared_ptr<Text> {
|
||||
auto it = std::ranges::find_if(texts_, [&name](const auto& t) { return t.name == name; });
|
||||
|
||||
if (it != texts_.end()) {
|
||||
// Si está en modo lazy y no se ha cargado aún, lo carga ahora
|
||||
@@ -299,8 +299,8 @@ auto Resource::getText(const std::string &name) -> std::shared_ptr<Text> {
|
||||
}
|
||||
|
||||
// Obtiene la animación a partir de un nombre (con carga perezosa)
|
||||
auto Resource::getAnimation(const std::string &name) -> AnimationsFileBuffer & {
|
||||
auto it = std::ranges::find_if(animations_, [&name](const auto &a) { return a.name == name; });
|
||||
auto Resource::getAnimation(const std::string& name) -> AnimationsFileBuffer& {
|
||||
auto it = std::ranges::find_if(animations_, [&name](const auto& a) { return a.name == name; });
|
||||
|
||||
if (it != animations_.end()) {
|
||||
// Si está en modo lazy y no se ha cargado aún (vector vacío), lo carga ahora
|
||||
@@ -315,16 +315,16 @@ auto Resource::getAnimation(const std::string &name) -> AnimationsFileBuffer & {
|
||||
}
|
||||
|
||||
// Obtiene el fichero con los datos para el modo demostración a partir de un índice
|
||||
auto Resource::getDemoData(int index) -> DemoData & {
|
||||
auto Resource::getDemoData(int index) -> DemoData& {
|
||||
return demos_.at(index);
|
||||
}
|
||||
|
||||
// --- Métodos de carga perezosa ---
|
||||
|
||||
auto Resource::loadSoundLazy(const std::string &name) -> JA_Sound_t * {
|
||||
auto Resource::loadSoundLazy(const std::string& name) -> JA_Sound_t* {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading sound lazily: %s", name.c_str());
|
||||
auto sound_list = Asset::get()->getListByType(Asset::Type::SOUND);
|
||||
for (const auto &file : sound_list) {
|
||||
for (const auto& file : sound_list) {
|
||||
if (getFileName(file) == name) {
|
||||
std::string audio_path = createTempAudioFile(file, Resource::get()->temp_audio_files_);
|
||||
return JA_LoadSound(audio_path.c_str());
|
||||
@@ -333,10 +333,10 @@ auto Resource::loadSoundLazy(const std::string &name) -> JA_Sound_t * {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto Resource::loadMusicLazy(const std::string &name) -> JA_Music_t * {
|
||||
auto Resource::loadMusicLazy(const std::string& name) -> JA_Music_t* {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading music lazily: %s", name.c_str());
|
||||
auto music_list = Asset::get()->getListByType(Asset::Type::MUSIC);
|
||||
for (const auto &file : music_list) {
|
||||
for (const auto& file : music_list) {
|
||||
if (getFileName(file) == name) {
|
||||
std::string audio_path = createTempAudioFile(file, Resource::get()->temp_audio_files_);
|
||||
return JA_LoadMusic(audio_path.c_str());
|
||||
@@ -345,10 +345,10 @@ auto Resource::loadMusicLazy(const std::string &name) -> JA_Music_t * {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto Resource::loadTextureLazy(const std::string &name) -> std::shared_ptr<Texture> {
|
||||
auto Resource::loadTextureLazy(const std::string& name) -> std::shared_ptr<Texture> {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading texture lazily: %s", name.c_str());
|
||||
auto texture_list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
for (const auto &file : texture_list) {
|
||||
for (const auto& file : texture_list) {
|
||||
if (getFileName(file) == name) {
|
||||
return std::make_shared<Texture>(Screen::get()->getRenderer(), file);
|
||||
}
|
||||
@@ -356,10 +356,10 @@ auto Resource::loadTextureLazy(const std::string &name) -> std::shared_ptr<Textu
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto Resource::loadTextFileLazy(const std::string &name) -> std::shared_ptr<Text::File> {
|
||||
auto Resource::loadTextFileLazy(const std::string& name) -> std::shared_ptr<Text::File> {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading text file lazily: %s", name.c_str());
|
||||
auto text_file_list = Asset::get()->getListByType(Asset::Type::FONT);
|
||||
for (const auto &file : text_file_list) {
|
||||
for (const auto& file : text_file_list) {
|
||||
if (getFileName(file) == name) {
|
||||
return Text::loadFile(file);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ auto Resource::loadTextFileLazy(const std::string &name) -> std::shared_ptr<Text
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto Resource::loadTextLazy(const std::string &name) -> std::shared_ptr<Text> {
|
||||
auto Resource::loadTextLazy(const std::string& name) -> std::shared_ptr<Text> {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading text object lazily: %s", name.c_str());
|
||||
|
||||
// Mapeo de objetos de texto a sus recursos
|
||||
@@ -391,7 +391,7 @@ auto Resource::loadTextLazy(const std::string &name) -> std::shared_ptr<Text> {
|
||||
{.key = "smb2", .texture_file = "smb2.png", .text_file = "smb2.txt"},
|
||||
{.key = "smb2_grad", .texture_file = "smb2_grad.png", .text_file = "smb2.txt"}};
|
||||
|
||||
for (const auto &mapping : TEXT_MAPPINGS) {
|
||||
for (const auto& mapping : TEXT_MAPPINGS) {
|
||||
if (mapping.key == name) {
|
||||
// Cargar las dependencias automáticamente
|
||||
auto texture = getTexture(mapping.texture_file); // Esto cargará la textura si no está cargada
|
||||
@@ -406,10 +406,10 @@ auto Resource::loadTextLazy(const std::string &name) -> std::shared_ptr<Text> {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto Resource::loadAnimationLazy(const std::string &name) -> AnimationsFileBuffer {
|
||||
auto Resource::loadAnimationLazy(const std::string& name) -> AnimationsFileBuffer {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loading animation lazily: %s", name.c_str());
|
||||
auto animation_list = Asset::get()->getListByType(Asset::Type::ANIMATION);
|
||||
for (const auto &file : animation_list) {
|
||||
for (const auto& file : animation_list) {
|
||||
if (getFileName(file) == name) {
|
||||
return loadAnimationsFromFile(file);
|
||||
}
|
||||
@@ -436,13 +436,13 @@ void Resource::load() {
|
||||
initProgressBar();
|
||||
|
||||
// Muerstra la ventana y desactiva el sincronismo vertical
|
||||
auto *screen = Screen::get();
|
||||
auto* screen = Screen::get();
|
||||
auto vsync = Screen::getVSync();
|
||||
screen->setVSync(false);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES");
|
||||
loadSounds(); // Carga sonidos
|
||||
loadMusics(); // Carga músicas
|
||||
loadSounds(); // Carga sonidos
|
||||
loadMusics(); // Carga músicas
|
||||
loadTextures(); // Carga texturas
|
||||
loadTextFiles(); // Carga ficheros de texto
|
||||
loadAnimations(); // Carga animaciones
|
||||
@@ -472,7 +472,7 @@ void Resource::loadSounds() {
|
||||
auto list = Asset::get()->getListByType(Asset::Type::SOUND);
|
||||
sounds_.clear();
|
||||
|
||||
for (const auto &l : list) {
|
||||
for (const auto& l : list) {
|
||||
auto name = getFileName(l);
|
||||
updateLoadingProgress(name);
|
||||
std::string audio_path = createTempAudioFile(l, temp_audio_files_);
|
||||
@@ -487,7 +487,7 @@ void Resource::loadMusics() {
|
||||
auto list = Asset::get()->getListByType(Asset::Type::MUSIC);
|
||||
musics_.clear();
|
||||
|
||||
for (const auto &l : list) {
|
||||
for (const auto& l : list) {
|
||||
auto name = getFileName(l);
|
||||
updateLoadingProgress(name);
|
||||
std::string audio_path = createTempAudioFile(l, temp_audio_files_);
|
||||
@@ -502,7 +502,7 @@ void Resource::loadTextures() {
|
||||
auto list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
textures_.clear();
|
||||
|
||||
for (const auto &l : list) {
|
||||
for (const auto& l : list) {
|
||||
auto name = getFileName(l);
|
||||
updateLoadingProgress(name);
|
||||
textures_.emplace_back(name, std::make_shared<Texture>(Screen::get()->getRenderer(), l));
|
||||
@@ -515,7 +515,7 @@ void Resource::loadTextFiles() {
|
||||
auto list = Asset::get()->getListByType(Asset::Type::FONT);
|
||||
text_files_.clear();
|
||||
|
||||
for (const auto &l : list) {
|
||||
for (const auto& l : list) {
|
||||
auto name = getFileName(l);
|
||||
updateLoadingProgress(name);
|
||||
text_files_.emplace_back(name, Text::loadFile(l));
|
||||
@@ -528,7 +528,7 @@ void Resource::loadAnimations() {
|
||||
auto list = Asset::get()->getListByType(Asset::Type::ANIMATION);
|
||||
animations_.clear();
|
||||
|
||||
for (const auto &l : list) {
|
||||
for (const auto& l : list) {
|
||||
auto name = getFileName(l);
|
||||
updateLoadingProgress(name);
|
||||
animations_.emplace_back(name, loadAnimationsFromFile(l));
|
||||
@@ -539,9 +539,9 @@ void Resource::loadAnimations() {
|
||||
void Resource::loadDemoData() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> DEMO FILES");
|
||||
|
||||
constexpr std::array<const char *, 2> DEMO_FILES = {"demo1.bin", "demo2.bin"};
|
||||
constexpr std::array<const char*, 2> DEMO_FILES = {"demo1.bin", "demo2.bin"};
|
||||
|
||||
for (const auto &file : DEMO_FILES) {
|
||||
for (const auto& file : DEMO_FILES) {
|
||||
updateLoadingProgress(file);
|
||||
demos_.emplace_back(loadDemoDataFromFile(Asset::get()->get(file)));
|
||||
}
|
||||
@@ -564,12 +564,12 @@ void Resource::createPlayerTextures() {
|
||||
|
||||
// Bucle principal
|
||||
for (size_t player_idx = 0; player_idx < players.size(); ++player_idx) {
|
||||
const auto &player = players[player_idx]; // Obtenemos el jugador actual
|
||||
const auto& player = players[player_idx]; // Obtenemos el jugador actual
|
||||
|
||||
// Encontrar el archivo original de la textura
|
||||
std::string texture_file_path;
|
||||
auto texture_list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
for (const auto &file : texture_list) {
|
||||
for (const auto& file : texture_list) {
|
||||
if (getFileName(file) == player.base_texture) {
|
||||
texture_file_path = file;
|
||||
break;
|
||||
@@ -650,7 +650,7 @@ void Resource::createTextTextures() {
|
||||
{"game_text_1000000_points", Lang::getText("[GAME_TEXT] 8")}};
|
||||
|
||||
auto text1 = getText("04b_25_enhanced");
|
||||
for (const auto &s : strings1) {
|
||||
for (const auto& s : strings1) {
|
||||
textures_.emplace_back(s.name, text1->writeDXToTexture(Text::STROKE, s.text, -2, Colors::NO_COLOR_MOD, 1, param.game.item_text_outline_color));
|
||||
printWithDots("Texture : ", s.name, "[ DONE ]");
|
||||
}
|
||||
@@ -665,7 +665,7 @@ void Resource::createTextTextures() {
|
||||
{"game_text_game_over", "Game Over"}};
|
||||
|
||||
auto text2 = getText("04b_25_2x_enhanced");
|
||||
for (const auto &s : strings2) {
|
||||
for (const auto& s : strings2) {
|
||||
textures_.emplace_back(s.name, text2->writeDXToTexture(Text::STROKE, s.text, -4, Colors::NO_COLOR_MOD, 1, param.game.item_text_outline_color));
|
||||
printWithDots("Texture : ", s.name, "[ DONE ]");
|
||||
}
|
||||
@@ -705,7 +705,7 @@ void Resource::createText() {
|
||||
{"smb2", "smb2.png", "smb2.txt"},
|
||||
{"smb2_grad", "smb2_grad.png", "smb2.txt"}};
|
||||
|
||||
for (const auto &resource : resources) {
|
||||
for (const auto& resource : resources) {
|
||||
if (!resource.white_texture_file.empty()) {
|
||||
// Crear texto con textura blanca
|
||||
texts_.emplace_back(resource.key, std::make_shared<Text>(getTexture(resource.texture_file), getTexture(resource.white_texture_file), getTextFile(resource.text_file)));
|
||||
@@ -719,7 +719,7 @@ void Resource::createText() {
|
||||
|
||||
// Vacía el vector de sonidos y libera la memoria asociada
|
||||
void Resource::clearSounds() {
|
||||
for (auto &sound : sounds_) {
|
||||
for (auto& sound : sounds_) {
|
||||
if (sound.sound != nullptr) {
|
||||
JA_DeleteSound(sound.sound);
|
||||
sound.sound = nullptr;
|
||||
@@ -730,7 +730,7 @@ void Resource::clearSounds() {
|
||||
|
||||
// Vacía el vector de músicas y libera la memoria asociada
|
||||
void Resource::clearMusics() {
|
||||
for (auto &music : musics_) {
|
||||
for (auto& music : musics_) {
|
||||
if (music.music != nullptr) {
|
||||
JA_DeleteMusic(music.music);
|
||||
music.music = nullptr;
|
||||
@@ -750,7 +750,7 @@ void Resource::calculateTotalResources() {
|
||||
Asset::Type::DEMODATA};
|
||||
|
||||
size_t total = 0;
|
||||
for (const auto &asset_type : ASSET_TYPES) {
|
||||
for (const auto& asset_type : ASSET_TYPES) {
|
||||
auto list = Asset::get()->getListByType(asset_type);
|
||||
total += list.size();
|
||||
}
|
||||
@@ -761,8 +761,8 @@ void Resource::calculateTotalResources() {
|
||||
// Muestra el progreso de carga en pantalla (barra y texto)
|
||||
void Resource::renderProgress() {
|
||||
// Obtiene la pantalla y el renderer
|
||||
auto *screen = Screen::get();
|
||||
auto *renderer = screen->getRenderer();
|
||||
auto* screen = Screen::get();
|
||||
auto* renderer = screen->getRenderer();
|
||||
|
||||
// Actualiza la lógica principal de la pantalla (input, etc.)
|
||||
screen->coreUpdate();
|
||||
@@ -837,9 +837,9 @@ void Resource::checkEvents() {
|
||||
void Resource::loadDemoDataQuiet() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> DEMO FILES (quiet load)");
|
||||
|
||||
constexpr std::array<const char *, 2> DEMO_FILES = {"demo1.bin", "demo2.bin"};
|
||||
constexpr std::array<const char*, 2> DEMO_FILES = {"demo1.bin", "demo2.bin"};
|
||||
|
||||
for (const auto &file : DEMO_FILES) {
|
||||
for (const auto& file : DEMO_FILES) {
|
||||
demos_.emplace_back(loadDemoDataFromFile(Asset::get()->get(file)));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Demo file loaded: %s", file);
|
||||
}
|
||||
@@ -872,13 +872,13 @@ void Resource::updateProgressBar() {
|
||||
|
||||
// Limpia archivos temporales de audio
|
||||
void Resource::cleanupTempAudioFiles() {
|
||||
for (const auto &temp_path : temp_audio_files_) {
|
||||
for (const auto& temp_path : temp_audio_files_) {
|
||||
try {
|
||||
if (std::filesystem::exists(temp_path)) {
|
||||
std::filesystem::remove(temp_path);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Removed temp audio file: %s", temp_path.c_str());
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
} catch (const std::exception& e) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to remove temp audio file %s: %s", temp_path.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user