eliminat el soport per a arguments
This commit is contained in:
@@ -44,14 +44,16 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Director::Director(std::vector<std::string> const& args) {
|
Director::Director() {
|
||||||
std::cout << "Game start" << '\n';
|
std::cout << "Game start" << '\n';
|
||||||
|
|
||||||
// Crea e inicializa las opciones del programa
|
// Crea e inicializa las opciones del programa
|
||||||
Options::init();
|
Options::init();
|
||||||
|
|
||||||
// Comprueba los parametros del programa
|
// Obtiene la ruta del ejecutable
|
||||||
executable_path_ = getPath(checkProgramArguments(args));
|
std::string base = SDL_GetBasePath();
|
||||||
|
if (!base.empty() && base.back() == '/') base.pop_back();
|
||||||
|
executable_path_ = base;
|
||||||
|
|
||||||
// Crea la carpeta del sistema donde guardar datos
|
// Crea la carpeta del sistema donde guardar datos
|
||||||
createSystemFolder("jailgames");
|
createSystemFolder("jailgames");
|
||||||
@@ -234,28 +236,6 @@ Director::~Director() {
|
|||||||
std::cout << "\nBye!" << '\n';
|
std::cout << "\nBye!" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los parametros del programa
|
|
||||||
auto Director::checkProgramArguments(std::vector<std::string> const& args) -> std::string { // NOLINT(readability-identifier-naming)
|
|
||||||
// Iterar sobre los argumentos del programa (saltando args[0] que es el ejecutable)
|
|
||||||
for (std::size_t i = 1; i < args.size(); ++i) {
|
|
||||||
const std::string& argument = args[i];
|
|
||||||
|
|
||||||
if (argument == "--console") {
|
|
||||||
Options::console = true;
|
|
||||||
} else if (argument == "--infiniteLives") {
|
|
||||||
Options::cheats.infinite_lives = Options::Cheat::State::ENABLED;
|
|
||||||
} else if (argument == "--invincible") {
|
|
||||||
Options::cheats.invincible = Options::Cheat::State::ENABLED;
|
|
||||||
} else if (argument == "--jailEnabled") {
|
|
||||||
Options::cheats.jail_is_open = Options::Cheat::State::ENABLED;
|
|
||||||
} else if (argument == "--altSkin") {
|
|
||||||
Options::game.player_skin = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return args[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Crea la carpeta del sistema donde guardar datos
|
// Crea la carpeta del sistema donde guardar datos
|
||||||
void Director::createSystemFolder(const std::string& folder) { // NOLINT(readability-convert-member-functions-to-static)
|
void Director::createSystemFolder(const std::string& folder) { // NOLINT(readability-convert-member-functions-to-static)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
@@ -3,19 +3,17 @@
|
|||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
#include <vector> // Para vector
|
|
||||||
|
|
||||||
class Director {
|
class Director {
|
||||||
public:
|
public:
|
||||||
explicit Director(std::vector<std::string> const& args); // Constructor
|
Director(); // Constructor
|
||||||
~Director(); // Destructor
|
~Director(); // Destructor
|
||||||
static auto run() -> int; // Bucle principal
|
static auto run() -> int; // Bucle principal
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// --- Variables ---
|
// --- Variables ---
|
||||||
std::string executable_path_; // Path del ejecutable
|
std::string executable_path_; // Path del ejecutable
|
||||||
std::string system_folder_; // Carpeta del sistema donde guardar datos
|
std::string system_folder_; // Carpeta del sistema donde guardar datos
|
||||||
static auto checkProgramArguments(std::vector<std::string> const& args) -> std::string; // Comprueba los parametros del programa
|
|
||||||
|
|
||||||
// --- Funciones ---
|
// --- Funciones ---
|
||||||
void createSystemFolder(const std::string& folder); // Crea la carpeta del sistema donde guardar datos
|
void createSystemFolder(const std::string& folder); // Crea la carpeta del sistema donde guardar datos
|
||||||
|
|||||||
@@ -6,17 +6,12 @@ Empezado en Castalla el 01/07/2022.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "core/system/director.hpp"
|
#include "core/system/director.hpp"
|
||||||
|
|
||||||
auto main(int argc, char* argv[]) -> int {
|
auto main() -> int {
|
||||||
// Convierte argumentos a formato moderno C++
|
|
||||||
std::vector<std::string> args(argv, argv + argc);
|
|
||||||
|
|
||||||
// Crea el objeto Director
|
// Crea el objeto Director
|
||||||
auto director = std::make_unique<Director>(args);
|
auto director = std::make_unique<Director>();
|
||||||
|
|
||||||
// Bucle principal
|
// Bucle principal
|
||||||
return Director::run();
|
return Director::run();
|
||||||
|
|||||||
Reference in New Issue
Block a user