Precarga de los ficheros .txt con los offsets del texto

This commit is contained in:
2022-10-29 11:17:33 +02:00
parent c1f0f90b16
commit 0758cf9de1
14 changed files with 203 additions and 36 deletions

View File

@@ -36,7 +36,7 @@ Director::Director(std::string path)
screen = new Screen(window, renderer, options, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
screen->setBorderColor(borderColor);
screen->setVideoMode(options->fullScreenMode);
debug = new Debug(renderer, screen, resource, asset);
debug = new Debug(renderer, screen, asset);
music = JA_LoadMusic(asset->get("title.ogg").c_str());
}
@@ -181,7 +181,7 @@ bool Director::saveConfig()
// Carga los recursos
void Director::loadResources(section_t section)
{
std::cout << "** LOAD RESOURCES" << std::endl;
std::cout << "** LOAD RESOURCES" << std::endl;
if (section.name == SECTION_PROG_LOGO)
{
@@ -211,6 +211,12 @@ void Director::loadResources(section_t section)
textureList.push_back("smb2.png");
resource->loadTextures(textureList);
// Offsets
std::vector<std::string> offsetsList;
offsetsList.push_back("smb2.txt");
resource->loadOffsets(offsetsList);
}
else if (section.name == SECTION_PROG_CREDITS)
@@ -222,10 +228,17 @@ void Director::loadResources(section_t section)
resource->loadTextures(textureList);
// Animaciones
std::vector<std::string> animationList;
animationList.push_back("shine");
resource->loadAnimations(animationList);
// Offsets
std::vector<std::string> offsetsList;
offsetsList.push_back("smb2.txt");
resource->loadOffsets(offsetsList);
}
else if (section.name == SECTION_PROG_GAME || section.name == SECTION_PROG_DEMO)
@@ -293,7 +306,7 @@ void Director::loadResources(section_t section)
// Animaciones
std::vector<std::string> animationList;
// Jugador
animationList.push_back("player");
@@ -340,9 +353,16 @@ void Director::loadResources(section_t section)
animationList.push_back("bat");
resource->loadAnimations(animationList);
// Offsets
std::vector<std::string> offsetsList;
offsetsList.push_back("smb2.txt");
offsetsList.push_back("debug.txt");
resource->loadOffsets(offsetsList);
}
std::cout << "** RESOURCES LOADED" << std::endl;
std::cout << "** RESOURCES LOADED" << std::endl;
}
// Asigna variables a partir de dos cadenas