Continuem estandaritzant noms
This commit is contained in:
@@ -60,7 +60,7 @@ Director::Director(int argc, char *argv[])
|
||||
createSystemFolder("jailgames/coffee_crisis_arcade_edition");
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
Asset::init(executablePath);
|
||||
Asset::init(executable_path_);
|
||||
|
||||
// Si falta algún fichero no inicia el programa
|
||||
if (!setFileList())
|
||||
@@ -75,7 +75,7 @@ Director::Director(int argc, char *argv[])
|
||||
#ifdef ANBERNIC
|
||||
const std::string paramFilePath = asset->get("param_320x240.txt");
|
||||
#else
|
||||
const std::string paramFilePath = paramFileArgument == "--320x240" ? Asset::get()->get("param_320x240.txt") : Asset::get()->get("param_320x256.txt");
|
||||
const std::string paramFilePath = param_file_argument_ == "--320x240" ? Asset::get()->get("param_320x240.txt") : Asset::get()->get("param_320x256.txt");
|
||||
#endif
|
||||
loadParams(paramFilePath);
|
||||
|
||||
@@ -90,7 +90,7 @@ Director::Director(int argc, char *argv[])
|
||||
initJailAudio();
|
||||
|
||||
// Inicializa el texto de debug
|
||||
dbg_init(renderer);
|
||||
dbg_init(renderer_);
|
||||
|
||||
// Crea los objetos
|
||||
lang::loadFromFile(getLangFile((lang::lang_e)options.game.language));
|
||||
@@ -98,7 +98,7 @@ Director::Director(int argc, char *argv[])
|
||||
Input::init(Asset::get()->get("gamecontrollerdb.txt"));
|
||||
initInput();
|
||||
|
||||
Screen::init(window, renderer);
|
||||
Screen::init(window_, renderer_);
|
||||
|
||||
OnScreenHelp::init();
|
||||
|
||||
@@ -120,11 +120,11 @@ Director::~Director()
|
||||
Screen::destroy();
|
||||
OnScreenHelp::destroy();
|
||||
|
||||
sounds.clear();
|
||||
musics.clear();
|
||||
sounds_.clear();
|
||||
musics_.clear();
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_DestroyRenderer(renderer_);
|
||||
SDL_DestroyWindow(window_);
|
||||
|
||||
SDL_Quit();
|
||||
}
|
||||
@@ -290,8 +290,8 @@ bool Director::initSDL()
|
||||
}
|
||||
#endif // NO_SHADERS
|
||||
// Crea la ventana
|
||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, param.game.width * options.video.window.size, param.game.height * options.video.window.size, SDL_WINDOW_HIDDEN);
|
||||
if (!window)
|
||||
window_ = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, param.game.width * options.video.window.size, param.game.height * options.video.window.size, SDL_WINDOW_HIDDEN);
|
||||
if (!window_)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
@@ -310,9 +310,9 @@ bool Director::initSDL()
|
||||
// La aceleración se activa según el define
|
||||
flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
|
||||
#endif
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
renderer_ = SDL_CreateRenderer(window_, -1, flags);
|
||||
|
||||
if (!renderer)
|
||||
if (!renderer_)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
@@ -322,14 +322,14 @@ bool Director::initSDL()
|
||||
else
|
||||
{
|
||||
// Inicializa el color de renderizado
|
||||
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
|
||||
SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF);
|
||||
|
||||
// Establece el tamaño del buffer de renderizado
|
||||
SDL_RenderSetLogicalSize(renderer, param.game.width, param.game.height);
|
||||
SDL_RenderSetIntegerScale(renderer, static_cast<SDL_bool>(options.video.integer_scale));
|
||||
SDL_RenderSetLogicalSize(renderer_, param.game.width, param.game.height);
|
||||
SDL_RenderSetIntegerScale(renderer_, static_cast<SDL_bool>(options.video.integer_scale));
|
||||
|
||||
// Establece el modo de mezcla
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,8 +350,8 @@ bool Director::setFileList()
|
||||
#endif
|
||||
|
||||
// Ficheros de configuración
|
||||
Asset::get()->add(systemFolder + "/config.txt", AssetType::DATA, false, true);
|
||||
Asset::get()->add(systemFolder + "/score.bin", AssetType::DATA, false, true);
|
||||
Asset::get()->add(system_folder_ + "/config.txt", AssetType::DATA, false, true);
|
||||
Asset::get()->add(system_folder_ + "/score.bin", AssetType::DATA, false, true);
|
||||
Asset::get()->add(prefix + "/data/config/param_320x240.txt", AssetType::DATA);
|
||||
Asset::get()->add(prefix + "/data/config/param_320x256.txt", AssetType::DATA);
|
||||
Asset::get()->add(prefix + "/data/config/demo1.bin", AssetType::DATA);
|
||||
@@ -493,17 +493,17 @@ void Director::loadParams(std::string filepath)
|
||||
void Director::checkProgramArguments(int argc, char *argv[])
|
||||
{
|
||||
// Establece la ruta del programa
|
||||
executablePath = argv[0];
|
||||
executable_path_ = argv[0];
|
||||
|
||||
// Valores por defecto
|
||||
paramFileArgument = "";
|
||||
param_file_argument_ = "";
|
||||
|
||||
// Comprueba el resto de parametros
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (strcmp(argv[i], "--320x240") == 0)
|
||||
{
|
||||
paramFileArgument = argv[i];
|
||||
param_file_argument_ = argv[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,25 +512,36 @@ void Director::checkProgramArguments(int argc, char *argv[])
|
||||
void Director::createSystemFolder(std::string folder)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
systemFolder = std::string(getenv("APPDATA")) + "/" + folder;
|
||||
system_folder_ = std::string(getenv("APPDATA")) + "/" + folder;
|
||||
#elif __APPLE__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
systemFolder = std::string(homedir) + "/Library/Application Support" + "/" + folder;
|
||||
system_folder_ = std::string(homedir) + "/Library/Application Support" + "/" + folder;
|
||||
#elif __linux__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
systemFolder = std::string(homedir) + "/.config/" + folder;
|
||||
system_folder_ = std::string(homedir) + "/.config/" + folder;
|
||||
|
||||
{
|
||||
// Intenta crear ".config", per si no existeix
|
||||
std::string config_base_folder = std::string(homedir) + "/.config";
|
||||
int ret = mkdir(config_base_folder.c_str(), S_IRWXU);
|
||||
if (ret == -1 && errno != EEXIST)
|
||||
{
|
||||
printf("ERROR CREATING CONFIG BASE FOLDER.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
struct stat st = {0};
|
||||
if (stat(systemFolder.c_str(), &st) == -1)
|
||||
if (stat(system_folder_.c_str(), &st) == -1)
|
||||
{
|
||||
errno = 0;
|
||||
#ifdef _WIN32
|
||||
int ret = mkdir(systemFolder.c_str());
|
||||
int ret = mkdir(system_folder_.c_str());
|
||||
#else
|
||||
int ret = mkdir(systemFolder.c_str(), S_IRWXU);
|
||||
int ret = mkdir(system_folder_.c_str(), S_IRWXU);
|
||||
#endif
|
||||
|
||||
if (ret == -1)
|
||||
@@ -562,7 +573,7 @@ void Director::loadSounds()
|
||||
{
|
||||
// Obtiene la lista con las rutas a los ficheros de sonidos
|
||||
std::vector<std::string> list = Asset::get()->getListByType(AssetType::SOUND);
|
||||
sounds.clear();
|
||||
sounds_.clear();
|
||||
|
||||
for (auto l : list)
|
||||
{
|
||||
@@ -571,7 +582,7 @@ void Director::loadSounds()
|
||||
SoundFile temp;
|
||||
temp.name = name; // Añade el nombre del fichero
|
||||
temp.file = JA_LoadSound(l.c_str()); // Carga el fichero de audio
|
||||
sounds.push_back(temp);
|
||||
sounds_.push_back(temp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,7 +591,7 @@ void Director::loadMusics()
|
||||
{
|
||||
// Obtiene la lista con las rutas a los ficheros musicales
|
||||
std::vector<std::string> list = Asset::get()->getListByType(AssetType::MUSIC);
|
||||
musics.clear();
|
||||
musics_.clear();
|
||||
|
||||
for (auto l : list)
|
||||
{
|
||||
@@ -589,7 +600,7 @@ void Director::loadMusics()
|
||||
MusicFile temp;
|
||||
temp.name = name; // Añade el nombre del fichero
|
||||
temp.file = JA_LoadMusic(l.c_str()); // Carga el fichero de audio
|
||||
musics.push_back(temp);
|
||||
musics_.push_back(temp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,7 +615,7 @@ void Director::runLogo()
|
||||
// Ejecuta la sección con la secuencia de introducción
|
||||
void Director::runIntro()
|
||||
{
|
||||
auto intro = new Intro(getMusic(musics, "intro.ogg"));
|
||||
auto intro = new Intro(getMusic(musics_, "intro.ogg"));
|
||||
intro->run();
|
||||
delete intro;
|
||||
}
|
||||
@@ -612,7 +623,7 @@ void Director::runIntro()
|
||||
// Ejecuta la sección con el titulo del juego
|
||||
void Director::runTitle()
|
||||
{
|
||||
auto title = new Title(getMusic(musics, "title.ogg"));
|
||||
auto title = new Title(getMusic(musics_, "title.ogg"));
|
||||
title->run();
|
||||
delete title;
|
||||
}
|
||||
@@ -622,7 +633,7 @@ void Director::runGame()
|
||||
{
|
||||
const auto playerID = section::options == section::OPTIONS_GAME_PLAY_1P ? 1 : 2;
|
||||
constexpr auto currentStage = 0;
|
||||
auto game = new Game(playerID, currentStage, GAME_MODE_DEMO_OFF, getMusic(musics, "playing.ogg"));
|
||||
auto game = new Game(playerID, currentStage, GAME_MODE_DEMO_OFF, getMusic(musics_, "playing.ogg"));
|
||||
game->run();
|
||||
delete game;
|
||||
}
|
||||
@@ -630,7 +641,7 @@ void Director::runGame()
|
||||
// Ejecuta la sección donde se muestran las instrucciones
|
||||
void Director::runInstructions()
|
||||
{
|
||||
auto instructions = new Instructions(getMusic(musics, "title.ogg"));
|
||||
auto instructions = new Instructions(getMusic(musics_, "title.ogg"));
|
||||
instructions->run();
|
||||
delete instructions;
|
||||
}
|
||||
@@ -638,7 +649,7 @@ void Director::runInstructions()
|
||||
// Ejecuta la sección donde se muestra la tabla de puntuaciones
|
||||
void Director::runHiScoreTable()
|
||||
{
|
||||
auto hiScoreTable = new HiScoreTable(getMusic(musics, "title.ogg"));
|
||||
auto hiScoreTable = new HiScoreTable(getMusic(musics_, "title.ogg"));
|
||||
hiScoreTable->run();
|
||||
delete hiScoreTable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user