forked from jaildesigner-jailgames/jaildoctors_dilemma
Acabat amb els singletones, de moment
Arreglat els checkEvents
This commit is contained in:
@@ -18,26 +18,27 @@
|
||||
#include <iostream> // Para basic_ostream, operator<<, cout
|
||||
#include <string> // Para basic_string, operator+, char_...
|
||||
#include <vector> // Para vector
|
||||
#include <memory>
|
||||
#include "asset.h" // Para Asset, assetType
|
||||
#include "const.h" // Para SECTION_LOGO, SECTION_TITLE
|
||||
#include "debug.h" // Para Debug
|
||||
#include "credits.h" // Para Credits
|
||||
#include "demo.h" // Para Demo
|
||||
#include "ending.h" // Para Ending
|
||||
#include "ending2.h" // Para Ending2
|
||||
#include "game.h" // Para Game
|
||||
#include "game_over.h" // Para GameOver
|
||||
#include "loading_screen.h" // Para LoadingScreen
|
||||
#include "logo.h" // Para Logo
|
||||
#include "title.h" // Para Title
|
||||
#include "input.h" // Para Input, inputs_e
|
||||
#include "jail_audio.h" // Para JA_GetMusicState, JA_DeleteMusic
|
||||
#include "resource.h" // Para Resource
|
||||
#include "screen.h" // Para Screen, FILTER_NEAREST, FILTER...
|
||||
#include "utils.h" // Para options_t, section_t, op_notif...
|
||||
#include <memory> // Para std::make_unique
|
||||
#include "asset.h" // Para Asset, assetType
|
||||
#include "const.h" // Para SECTION_LOGO, SECTION_TITLE
|
||||
#include "debug.h" // Para Debug
|
||||
#include "credits.h" // Para Credits
|
||||
#include "demo.h" // Para Demo
|
||||
#include "ending.h" // Para Ending
|
||||
#include "ending2.h" // Para Ending2
|
||||
#include "game.h" // Para Game
|
||||
#include "game_over.h" // Para GameOver
|
||||
#include "loading_screen.h" // Para LoadingScreen
|
||||
#include "logo.h" // Para Logo
|
||||
#include "title.h" // Para Title
|
||||
#include "input.h" // Para Input, inputs_e
|
||||
#include "jail_audio.h" // Para JA_GetMusicState, JA_DeleteMusic
|
||||
#include "resource.h" // Para Resource
|
||||
#include "screen.h" // Para Screen, FILTER_NEAREST, FILTER...
|
||||
#include "utils.h" // Para options_t, section_t, op_notif...
|
||||
#include "notifier.h"
|
||||
#include "options.h"
|
||||
#include "cheevos.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h>
|
||||
@@ -52,7 +53,7 @@ Director::Director(int argc, const char *argv[])
|
||||
initOptions();
|
||||
|
||||
// Comprueba los parametros del programa
|
||||
checkProgramArguments(argc, argv);
|
||||
executable_path_ = checkProgramArguments(argc, argv);
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
Asset::init(executable_path_);
|
||||
@@ -60,11 +61,7 @@ Director::Director(int argc, const char *argv[])
|
||||
|
||||
// Crea la carpeta del sistema donde guardar datos
|
||||
createSystemFolder("jailgames");
|
||||
#ifndef DEBUG
|
||||
createSystemFolder("jailgames/jaildoctors_dilemma");
|
||||
#else
|
||||
createSystemFolder("jailgames/jaildoctors_dilemma_debug");
|
||||
#endif
|
||||
|
||||
// Si falta algún fichero no inicia el programa
|
||||
if (!setFileList())
|
||||
@@ -90,12 +87,13 @@ Director::Director(int argc, const char *argv[])
|
||||
initInput();
|
||||
Debug::init();
|
||||
title_music_ = JA_LoadMusic(Asset::get()->get("title.ogg").c_str());
|
||||
Cheevos::init(Asset::get()->get("cheevos.bin"));
|
||||
}
|
||||
|
||||
Director::~Director()
|
||||
{
|
||||
// Guarda las opciones a un fichero
|
||||
saveOptionsFromFile(Asset::get()->get("config.txt"));
|
||||
saveOptionsToFile(Asset::get()->get("config.txt"));
|
||||
|
||||
// Destruye los singletones
|
||||
Asset::destroy();
|
||||
@@ -104,6 +102,7 @@ Director::~Director()
|
||||
Notifier::destroy();
|
||||
Debug::destroy();
|
||||
Resource::destroy();
|
||||
Cheevos::destroy();
|
||||
|
||||
JA_DeleteMusic(title_music_);
|
||||
|
||||
@@ -115,12 +114,9 @@ Director::~Director()
|
||||
}
|
||||
|
||||
// Comprueba los parametros del programa
|
||||
void Director::checkProgramArguments(int argc, const char *argv[])
|
||||
std::string Director::checkProgramArguments(int argc, const char *argv[])
|
||||
{
|
||||
// Establece la ruta del programa
|
||||
executable_path_ = argv[0];
|
||||
|
||||
// Comprueba el resto de parametros
|
||||
// Comprueba los parametros
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (strcmp(argv[i], "--console") == 0)
|
||||
@@ -148,6 +144,8 @@ void Director::checkProgramArguments(int argc, const char *argv[])
|
||||
options.cheat.altSkin = true;
|
||||
}
|
||||
}
|
||||
|
||||
return argv[0];
|
||||
}
|
||||
|
||||
// Crea la carpeta del sistema donde guardar datos
|
||||
@@ -902,7 +900,7 @@ bool Director::initSDL()
|
||||
else
|
||||
{
|
||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||
Uint32 flags = 0;
|
||||
Uint32 flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
|
||||
if (options.vSync)
|
||||
{
|
||||
flags = flags | SDL_RENDERER_PRESENTVSYNC;
|
||||
|
||||
Reference in New Issue
Block a user