forked from jaildesigner-jailgames/jaildoctors_dilemma
Retocando las constantes
This commit is contained in:
@@ -7,19 +7,19 @@
|
||||
// Constructor
|
||||
Director::Director(std::string path)
|
||||
{
|
||||
// Inicializa la ruta
|
||||
setExecutablePath(path);
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
asset = new Asset(executablePath);
|
||||
|
||||
// Establece la lista de ficheros
|
||||
setFileList();
|
||||
asset = new Asset(path.substr(0, path.find_last_of("\\/")));
|
||||
|
||||
// Si falta algún fichero no inicia el programa
|
||||
Uint8 section = SECTION_PROG_GAME;
|
||||
if (!asset->check())
|
||||
section = SECTION_PROG_QUIT;
|
||||
if (!setFileList())
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
section.name = SECTION_PROG_GAME;
|
||||
section.subsection = 0;
|
||||
}
|
||||
|
||||
// Crea el puntero a la estructura y carga el fichero de configuración
|
||||
options = new options_t;
|
||||
@@ -27,22 +27,21 @@ Director::Director(std::string path)
|
||||
options->windowSize = 2;
|
||||
options->filter = FILTER_NEAREST;
|
||||
options->vSync = true;
|
||||
options->screenWidth = GAME_WIDTH * options->windowSize;
|
||||
options->screenHeight = GAME_HEIGHT * options->windowSize;
|
||||
options->screenWidth = GAMECANVAS_WIDTH * options->windowSize;
|
||||
options->screenHeight = GAMECANVAS_HEIGHT * options->windowSize;
|
||||
options->integerScale = true;
|
||||
options->keepAspect = true;
|
||||
|
||||
// Crea los objetos
|
||||
input = new Input(asset->get("gamecontrollerdb.txt"));
|
||||
|
||||
// Inicializa SDL
|
||||
initSDL();
|
||||
|
||||
// Inicializa JailAudio
|
||||
initJailAudio();
|
||||
|
||||
// Inicializa el resto de variables
|
||||
init(section);
|
||||
|
||||
// Crea los objetos
|
||||
input = new Input(asset->get("gamecontrollerdb.txt"));
|
||||
initInput();
|
||||
screen = new Screen(window, renderer, options, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||
}
|
||||
|
||||
Director::~Director()
|
||||
@@ -58,13 +57,8 @@ Director::~Director()
|
||||
}
|
||||
|
||||
// Inicia las variables necesarias para arrancar el programa
|
||||
void Director::init(Uint8 name)
|
||||
void Director::initInput()
|
||||
{
|
||||
// Sección
|
||||
section.name = name;
|
||||
section.subsection = 0;
|
||||
|
||||
// Controles
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
|
||||
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
|
||||
@@ -101,7 +95,6 @@ bool Director::initSDL()
|
||||
|
||||
// Inicializa SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
||||
//if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||
{
|
||||
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
||||
success = false;
|
||||
@@ -156,13 +149,15 @@ bool Director::initSDL()
|
||||
}
|
||||
|
||||
// Crea el indice de ficheros
|
||||
void Director::setFileList()
|
||||
bool Director::setFileList()
|
||||
{
|
||||
asset->add("/media/font/smb2.png", font);
|
||||
asset->add("/media/font/smb2.txt", font);
|
||||
asset->add("/media/font/debug.png", font);
|
||||
asset->add("/media/font/debug.txt", font);
|
||||
|
||||
asset->add("/data/gamecontrollerdb.txt", data);
|
||||
|
||||
asset->add("/data/room/01.room", room);
|
||||
asset->add("/data/room/02.room", room);
|
||||
asset->add("/data/room/03.room", room);
|
||||
@@ -173,22 +168,22 @@ void Director::setFileList()
|
||||
asset->add("/data/room/03.tmx", room);
|
||||
asset->add("/data/room/04.tmx", room);
|
||||
asset->add("/data/room/05.tmx", room);
|
||||
|
||||
asset->add("/media/tilesets/standard.png", bitmap);
|
||||
|
||||
asset->add("/media/enemies/paco.png", bitmap);
|
||||
asset->add("/media/enemies/paco.ani", data);
|
||||
asset->add("/media/enemies/chip.png", bitmap);
|
||||
asset->add("/media/enemies/chip.ani", data);
|
||||
asset->add("/media/enemies/wave.png", bitmap);
|
||||
asset->add("/media/enemies/wave.ani", data);
|
||||
|
||||
asset->add("/media/player/player01.png", bitmap);
|
||||
asset->add("/media/player/player01.ani", data);
|
||||
|
||||
asset->add("/media/items/items.png", bitmap);
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Director::setExecutablePath(std::string path)
|
||||
{
|
||||
executablePath = path.substr(0, path.find_last_of("\\/"));
|
||||
return asset->check();
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
|
||||
Reference in New Issue
Block a user