forked from jaildesigner-jailgames/jaildoctors_dilemma
Movida la carga de recursos al objeto director
This commit is contained in:
@@ -177,6 +177,73 @@ bool Director::saveConfig()
|
||||
return success;
|
||||
}
|
||||
|
||||
// Carga los recursos
|
||||
void Director::loadResources(section_t section)
|
||||
{
|
||||
if (section.name == SECTION_PROG_GAME || section.name == SECTION_PROG_DEMO)
|
||||
{
|
||||
std::vector<std::string> textureList;
|
||||
|
||||
// Jugador
|
||||
textureList.push_back("player.png");
|
||||
|
||||
// Tilesets
|
||||
textureList.push_back("standard.png");
|
||||
textureList.push_back("standard_zxarne.png");
|
||||
|
||||
// Enemigos
|
||||
textureList.push_back("paco.png");
|
||||
textureList.push_back("chip.png");
|
||||
textureList.push_back("wave.png");
|
||||
textureList.push_back("wave_v.png");
|
||||
textureList.push_back("sigmasua.png");
|
||||
textureList.push_back("diskette.png");
|
||||
textureList.push_back("bird.png");
|
||||
textureList.push_back("bin.png");
|
||||
textureList.push_back("qvoid.png");
|
||||
textureList.push_back("batman.png");
|
||||
textureList.push_back("tuno.png");
|
||||
textureList.push_back("matatunos.png");
|
||||
textureList.push_back("abad.png");
|
||||
textureList.push_back("jailbattle_human.png");
|
||||
textureList.push_back("jailbattle_alien.png");
|
||||
textureList.push_back("jailer.png");
|
||||
textureList.push_back("jailer2.png");
|
||||
textureList.push_back("jailer3.png");
|
||||
textureList.push_back("printer.png");
|
||||
textureList.push_back("code.png");
|
||||
textureList.push_back("demon.png");
|
||||
textureList.push_back("dimallas.png");
|
||||
textureList.push_back("dimallas_v.png");
|
||||
textureList.push_back("heavy.png");
|
||||
textureList.push_back("spider.png");
|
||||
textureList.push_back("macaronni_ted.png");
|
||||
textureList.push_back("mummy.png");
|
||||
textureList.push_back("sam.png");
|
||||
textureList.push_back("amstrad_character_set.png");
|
||||
textureList.push_back("breakout.png");
|
||||
textureList.push_back("lamp.png");
|
||||
textureList.push_back("bry.png");
|
||||
textureList.push_back("tv.png");
|
||||
textureList.push_back("tv_panel.png");
|
||||
textureList.push_back("arounders_door.png");
|
||||
textureList.push_back("arounders_machine.png");
|
||||
textureList.push_back("arounder_walk.png");
|
||||
textureList.push_back("arounder_stop.png");
|
||||
textureList.push_back("arounder_fly.png");
|
||||
textureList.push_back("bat.png");
|
||||
|
||||
// Items
|
||||
textureList.push_back("items.png");
|
||||
|
||||
// Texto
|
||||
textureList.push_back("smb2.png");
|
||||
textureList.push_back("debug.png");
|
||||
|
||||
resource->loadTextures(textureList);
|
||||
}
|
||||
}
|
||||
|
||||
// Asigna variables a partir de dos cadenas
|
||||
bool Director::setOptions(options_t *options, std::string var, std::string value)
|
||||
{
|
||||
@@ -708,18 +775,22 @@ void Director::runCredits()
|
||||
// Ejecuta la seccion de la demo, donde se ven pantallas del juego
|
||||
void Director::runDemo()
|
||||
{
|
||||
loadResources(section);
|
||||
demo = new Demo(renderer, screen, resource, asset, options, debug);
|
||||
setSection(demo->run());
|
||||
delete demo;
|
||||
resource->freeTextures();
|
||||
}
|
||||
|
||||
// Ejecuta la seccion de juego donde se juega
|
||||
void Director::runGame()
|
||||
{
|
||||
JA_StopMusic();
|
||||
loadResources(section);
|
||||
game = new Game(renderer, screen, resource, asset, options, input, debug);
|
||||
setSection(game->run());
|
||||
delete game;
|
||||
resource->freeTextures();
|
||||
}
|
||||
|
||||
void Director::run()
|
||||
|
||||
Reference in New Issue
Block a user