afegit el namespace Logger
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "screen.hpp" // Para Screen
|
||||
#include "text.hpp" // Para Text
|
||||
#include "version.h" // Para Version::APP_NAME y Version::GIT_HASH
|
||||
#include "ui/logger.hpp" // Para Logger
|
||||
|
||||
struct JA_Music_t; // lines 11-11
|
||||
struct JA_Sound_t; // lines 12-12
|
||||
@@ -445,7 +446,7 @@ void Resource::load() {
|
||||
auto vsync = Screen::getVSync();
|
||||
screen->setVSync(false);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES");
|
||||
//SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES");
|
||||
loadSounds(); // Carga sonidos
|
||||
loadMusics(); // Carga músicas
|
||||
loadTextures(); // Carga texturas
|
||||
@@ -455,7 +456,7 @@ void Resource::load() {
|
||||
createText(); // Crea objetos de texto
|
||||
createTextTextures(); // Crea texturas a partir de texto
|
||||
createPlayerTextures(); // Crea las texturas de jugadores con todas sus variantes de paleta
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** RESOURCES LOADED");
|
||||
//SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** RESOURCES LOADED");
|
||||
|
||||
// Restablece el sincronismo vertical a su valor original
|
||||
screen->setVSync(vsync);
|
||||
@@ -473,7 +474,7 @@ void Resource::reload() {
|
||||
|
||||
// Carga los sonidos del juego
|
||||
void Resource::loadSounds() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> SOUND FILES");
|
||||
Logger::info("SOUND FILES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::SOUND);
|
||||
sounds_.clear();
|
||||
|
||||
@@ -482,13 +483,14 @@ void Resource::loadSounds() {
|
||||
updateLoadingProgress(name);
|
||||
std::string audio_path = createTempAudioFile(l, temp_audio_files_);
|
||||
sounds_.emplace_back(name, JA_LoadSound(audio_path.c_str()));
|
||||
printWithDots("Sound : ", name, "[ LOADED ]");
|
||||
Logger::dots("Sound : ", name, "[ LOADED ]");
|
||||
}
|
||||
}
|
||||
|
||||
// Carga las músicas del juego
|
||||
void Resource::loadMusics() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> MUSIC FILES");
|
||||
Logger::CR();
|
||||
Logger::info("MUSIC FILES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::MUSIC);
|
||||
musics_.clear();
|
||||
|
||||
@@ -497,13 +499,14 @@ void Resource::loadMusics() {
|
||||
updateLoadingProgress(name);
|
||||
std::string audio_path = createTempAudioFile(l, temp_audio_files_);
|
||||
musics_.emplace_back(name, JA_LoadMusic(audio_path.c_str()));
|
||||
printWithDots("Music : ", name, "[ LOADED ]");
|
||||
Logger::dots("Music : ", name, "[ LOADED ]");
|
||||
}
|
||||
}
|
||||
|
||||
// Carga las texturas del juego
|
||||
void Resource::loadTextures() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> TEXTURES");
|
||||
Logger::CR();
|
||||
Logger::info("TEXTURES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
textures_.clear();
|
||||
|
||||
@@ -516,7 +519,8 @@ void Resource::loadTextures() {
|
||||
|
||||
// Carga los ficheros de texto del juego
|
||||
void Resource::loadTextFiles() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> TEXT FILES");
|
||||
Logger::CR();
|
||||
Logger::info("TEXT FILES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::FONT);
|
||||
text_files_.clear();
|
||||
|
||||
@@ -529,7 +533,8 @@ void Resource::loadTextFiles() {
|
||||
|
||||
// Carga las animaciones del juego
|
||||
void Resource::loadAnimations() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> ANIMATIONS");
|
||||
Logger::CR();
|
||||
Logger::info("ANIMATIONS");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::ANIMATION);
|
||||
animations_.clear();
|
||||
|
||||
@@ -542,7 +547,8 @@ void Resource::loadAnimations() {
|
||||
|
||||
// Carga los datos para el modo demostración
|
||||
void Resource::loadDemoData() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> DEMO FILES");
|
||||
Logger::CR();
|
||||
Logger::info("DEMO FILES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::DEMODATA);
|
||||
demos_.clear();
|
||||
|
||||
@@ -555,7 +561,8 @@ void Resource::loadDemoData() {
|
||||
|
||||
// Crea las texturas de jugadores con todas sus variantes de paleta
|
||||
void Resource::createPlayerTextures() {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> CREATING PLAYER TEXTURES");
|
||||
Logger::CR();
|
||||
Logger::info("CREATING PLAYER TEXTURES");
|
||||
|
||||
// Configuración de jugadores y sus paletas
|
||||
struct PlayerConfig {
|
||||
@@ -627,7 +634,7 @@ void Resource::createPlayerTextures() {
|
||||
// Guardar con nombre específico
|
||||
std::string texture_name = player.name_prefix + "_pal" + std::to_string(palette_idx);
|
||||
textures_.emplace_back(texture_name, texture);
|
||||
printWithDots("Player Texture : ", texture_name, "[ DONE ]");
|
||||
Logger::dots("Player Texture : ", texture_name, "[ DONE ]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -643,7 +650,8 @@ void Resource::createTextTextures() {
|
||||
text(std::move(text_init)) {}
|
||||
};
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> CREATING TEXTURES");
|
||||
Logger::CR();
|
||||
Logger::info("CREATING TEXTURES");
|
||||
|
||||
// Texturas de tamaño normal con outline
|
||||
std::vector<NameAndText> strings1 = {
|
||||
@@ -658,7 +666,7 @@ void Resource::createTextTextures() {
|
||||
auto text1 = getText("04b_25_enhanced");
|
||||
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 ]");
|
||||
Logger::dots("Texture : ", s.name, "[ DONE ]");
|
||||
}
|
||||
|
||||
// Texturas de tamaño doble
|
||||
@@ -673,7 +681,7 @@ void Resource::createTextTextures() {
|
||||
auto text2 = getText("04b_25_2x_enhanced");
|
||||
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 ]");
|
||||
Logger::dots("Texture : ", s.name, "[ DONE ]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,7 +700,8 @@ void Resource::createText() {
|
||||
white_texture_file(std::move(w_file)) {}
|
||||
};
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> CREATING TEXT OBJECTS");
|
||||
Logger::CR();
|
||||
Logger::info("CREATING TEXT OBJECTS");
|
||||
|
||||
std::vector<ResourceInfo> resources = {
|
||||
{"04b_25", "04b_25.png", "04b_25.txt"},
|
||||
@@ -719,7 +728,7 @@ void Resource::createText() {
|
||||
// Crear texto normal
|
||||
texts_.emplace_back(resource.key, std::make_shared<Text>(getTexture(resource.texture_file), getTextFile(resource.text_file)));
|
||||
}
|
||||
printWithDots("Text : ", resource.key, "[ DONE ]");
|
||||
Logger::dots("Text : ", resource.key, "[ DONE ]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -881,7 +890,7 @@ void Resource::cleanupTempAudioFiles() {
|
||||
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());
|
||||
//SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Removed temp audio file: %s", temp_path.c_str());
|
||||
}
|
||||
} 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