acabat amb SDL_Log
This commit is contained in:
@@ -52,7 +52,7 @@ void Resource::clear()
|
||||
// Carga todos los recursos
|
||||
void Resource::load()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** LOADING RESOURCES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES");
|
||||
loadSounds();
|
||||
loadMusics();
|
||||
loadTextures();
|
||||
@@ -62,7 +62,7 @@ void Resource::load()
|
||||
addPalettes();
|
||||
createText();
|
||||
createTextures();
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** RESOURCES LOADED");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** RESOURCES LOADED");
|
||||
}
|
||||
|
||||
// Recarga todos los recursos
|
||||
@@ -179,7 +179,7 @@ DemoData &Resource::getDemoData(int index)
|
||||
// Carga los sonidos
|
||||
void Resource::loadSounds()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> SOUND FILES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> SOUND FILES");
|
||||
auto list = Asset::get()->getListByType(AssetType::SOUND);
|
||||
sounds_.clear();
|
||||
|
||||
@@ -187,14 +187,14 @@ void Resource::loadSounds()
|
||||
{
|
||||
auto name = getFileName(l);
|
||||
sounds_.emplace_back(ResourceSound(name, JA_LoadSound(l.c_str())));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Sound : %s [ LOADED ]", name.c_str());
|
||||
printWithDots("Sound : ", name, "[ LOADED ]");
|
||||
}
|
||||
}
|
||||
|
||||
// Carga las músicas
|
||||
void Resource::loadMusics()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> MUSIC FILES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> MUSIC FILES");
|
||||
auto list = Asset::get()->getListByType(AssetType::MUSIC);
|
||||
musics_.clear();
|
||||
|
||||
@@ -202,14 +202,14 @@ void Resource::loadMusics()
|
||||
{
|
||||
auto name = getFileName(l);
|
||||
musics_.emplace_back(ResourceMusic(name, JA_LoadMusic(l.c_str())));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Music : %s [ LOADED ]", name.c_str());
|
||||
printWithDots("Music : ", name, "[ LOADED ]");
|
||||
}
|
||||
}
|
||||
|
||||
// Carga las texturas
|
||||
void Resource::loadTextures()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> TEXTURES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> TEXTURES");
|
||||
auto list = Asset::get()->getListByType(AssetType::BITMAP);
|
||||
textures_.clear();
|
||||
|
||||
@@ -217,14 +217,13 @@ void Resource::loadTextures()
|
||||
{
|
||||
auto name = getFileName(l);
|
||||
textures_.emplace_back(ResourceTexture(name, std::make_shared<Texture>(Screen::get()->getRenderer(), l)));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Texture : %s [ LOADED ]", name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Carga los ficheros de texto
|
||||
void Resource::loadTextFiles()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> TEXT FILES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> TEXT FILES");
|
||||
auto list = Asset::get()->getListByType(AssetType::FONT);
|
||||
text_files_.clear();
|
||||
|
||||
@@ -232,14 +231,13 @@ void Resource::loadTextFiles()
|
||||
{
|
||||
auto name = getFileName(l);
|
||||
text_files_.emplace_back(ResourceTextFile(name, loadTextFile(l)));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "TextFile : %s [ LOADED ]", name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Carga las animaciones
|
||||
void Resource::loadAnimations()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> ANIMATIONS");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> ANIMATIONS");
|
||||
auto list = Asset::get()->getListByType(AssetType::ANIMATION);
|
||||
animations_.clear();
|
||||
|
||||
@@ -247,23 +245,21 @@ void Resource::loadAnimations()
|
||||
{
|
||||
auto name = getFileName(l);
|
||||
animations_.emplace_back(ResourceAnimation(name, loadAnimationsFromFile(l)));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Animation : %s [ LOADED ]", name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Carga los datos para el modo demostración
|
||||
void Resource::loadDemoData()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> DEMO FILES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> DEMO FILES");
|
||||
demos_.emplace_back(loadDemoDataFromFile(Asset::get()->get("demo1.bin")));
|
||||
demos_.emplace_back(loadDemoDataFromFile(Asset::get()->get("demo2.bin")));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Demo data loaded.");
|
||||
}
|
||||
|
||||
// Añade paletas a las texturas
|
||||
void Resource::addPalettes()
|
||||
{
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> PALETTES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> PALETTES");
|
||||
|
||||
// Jugador 1
|
||||
getTexture("player1.gif")->addPaletteFromFile(Asset::get()->get("player1_1_coffee_palette.gif"));
|
||||
@@ -291,7 +287,7 @@ void Resource::createTextures()
|
||||
: name(name_init), text(text_init) {}
|
||||
};
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> CREATING TEXTURES");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> CREATING TEXTURES");
|
||||
|
||||
// Tamaño normal
|
||||
std::vector<NameAndText> strings = {
|
||||
@@ -307,7 +303,7 @@ void Resource::createTextures()
|
||||
for (const auto &s : strings)
|
||||
{
|
||||
textures_.emplace_back(ResourceTexture(s.name, text->writeToTexture(s.text, 1, -2)));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Texture : %s [ DONE ]", s.name.c_str());
|
||||
printWithDots("Texture : ", s.name, "[ DONE ]");
|
||||
}
|
||||
|
||||
// Tamaño doble
|
||||
@@ -322,7 +318,7 @@ void Resource::createTextures()
|
||||
for (const auto &s : strings2X)
|
||||
{
|
||||
textures_.emplace_back(ResourceTexture(s.name, text2->writeToTexture(s.text, 1, -4)));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Texture : %s [ DONE ]", s.name.c_str());
|
||||
printWithDots("Texture : ", s.name, "[ DONE ]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +334,7 @@ void Resource::createText()
|
||||
: key(k), textureFile(tFile), textFile(txtFile) {}
|
||||
};
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, ">> CREATING TEXT OBJECTS");
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> CREATING TEXT OBJECTS");
|
||||
|
||||
std::vector<ResourceInfo> resources = {
|
||||
{"04b_25", "04b_25.png", "04b_25.txt"},
|
||||
@@ -353,7 +349,7 @@ void Resource::createText()
|
||||
texts_.emplace_back(ResourceText(resource.key, std::make_shared<Text>(
|
||||
getTexture(resource.textureFile),
|
||||
getTextFile(resource.textFile))));
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Text : %s [ DONE ]", resource.key.c_str());
|
||||
printWithDots("Text : ", resource.key, "[ DONE ]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user