eliminat soport per a arguments
This commit is contained in:
@@ -5,11 +5,9 @@
|
|||||||
|
|
||||||
#include <cstdlib> // Para srand, exit, rand, EXIT_FAILURE
|
#include <cstdlib> // Para srand, exit, rand, EXIT_FAILURE
|
||||||
#include <ctime> // Para time
|
#include <ctime> // Para time
|
||||||
#include <filesystem> // Para path, absolute
|
|
||||||
#include <fstream> // Para ifstream, ofstream
|
#include <fstream> // Para ifstream, ofstream
|
||||||
#include <iostream> // Para basic_ostream, operator<<, cerr
|
#include <iostream> // Para basic_ostream, operator<<, cerr
|
||||||
#include <memory> // Para make_unique, unique_ptr
|
#include <memory> // Para make_unique, unique_ptr
|
||||||
#include <span> // Para span
|
|
||||||
#include <stdexcept> // Para runtime_error
|
#include <stdexcept> // Para runtime_error
|
||||||
#include <string> // Para allocator, basic_string, char_traits, operator+, string, operator==
|
#include <string> // Para allocator, basic_string, char_traits, operator+, string, operator==
|
||||||
|
|
||||||
@@ -38,10 +36,9 @@
|
|||||||
#include "system_utils.hpp" // Para createApplicationFolder, resultToString, Result
|
#include "system_utils.hpp" // Para createApplicationFolder, resultToString, Result
|
||||||
#include "ui/notifier.hpp" // Para Notifier
|
#include "ui/notifier.hpp" // Para Notifier
|
||||||
#include "ui/service_menu.hpp" // Para ServiceMenu
|
#include "ui/service_menu.hpp" // Para ServiceMenu
|
||||||
#include "utils.hpp" // Para Overrides, overrides
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Director::Director(int argc, std::span<char*> argv) {
|
Director::Director() {
|
||||||
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
|
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
|
||||||
|
|
||||||
// Establece el nivel de prioridad de la categoría de registro
|
// Establece el nivel de prioridad de la categoría de registro
|
||||||
@@ -53,8 +50,9 @@ Director::Director(int argc, std::span<char*> argv) {
|
|||||||
|
|
||||||
std::cout << "Game start\n";
|
std::cout << "Game start\n";
|
||||||
|
|
||||||
// Comprueba los parametros del programa
|
// Obtener la ruta del ejecutable desde SDL
|
||||||
checkProgramArguments(argc, argv);
|
const char* base_path = SDL_GetBasePath();
|
||||||
|
executable_path_ = (base_path != nullptr) ? base_path : "";
|
||||||
|
|
||||||
// Crea la carpeta del sistema donde guardar los datos persistentes
|
// Crea la carpeta del sistema donde guardar los datos persistentes
|
||||||
createSystemFolder("jailgames");
|
createSystemFolder("jailgames");
|
||||||
@@ -173,11 +171,7 @@ void Director::loadScoreFile() {
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
manager->clear();
|
manager->clear();
|
||||||
#else
|
#else
|
||||||
if (overrides.clear_hi_score_table) {
|
|
||||||
manager->clear();
|
|
||||||
} else {
|
|
||||||
manager->loadFromFile(Asset::get()->getPath("score.bin"));
|
manager->loadFromFile(Asset::get()->getPath("score.bin"));
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,29 +193,6 @@ void Director::loadAssets() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los parametros del programa
|
|
||||||
void Director::checkProgramArguments(int argc, std::span<char*> argv) {
|
|
||||||
// Obtener la ruta absoluta del ejecutable
|
|
||||||
std::filesystem::path exe_path = std::filesystem::absolute(argv[0]);
|
|
||||||
executable_path_ = exe_path.parent_path().string();
|
|
||||||
|
|
||||||
// Asegurar que termine con separador de directorio
|
|
||||||
if (!executable_path_.empty() && executable_path_.back() != '/' && executable_path_.back() != '\\') {
|
|
||||||
executable_path_ += "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba el resto de parámetros
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
|
||||||
std::string arg = argv[i];
|
|
||||||
|
|
||||||
if (arg == "--320x240") {
|
|
||||||
overrides.param_file = arg;
|
|
||||||
} else if (arg == "--clear_score") {
|
|
||||||
overrides.clear_hi_score_table = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Carga debug.yaml desde la carpeta del sistema (solo en _DEBUG)
|
// Carga debug.yaml desde la carpeta del sistema (solo en _DEBUG)
|
||||||
void Director::loadDebugConfig() {
|
void Director::loadDebugConfig() {
|
||||||
const std::string DEBUG_FILE = system_folder_ + "/debug.yaml";
|
const std::string DEBUG_FILE = system_folder_ + "/debug.yaml";
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#include <SDL3/SDL.h> // Para SDL_AppResult, SDL_Event
|
#include <SDL3/SDL.h> // Para SDL_AppResult, SDL_Event
|
||||||
|
|
||||||
#include <memory> // Para unique_ptr
|
#include <memory> // Para unique_ptr
|
||||||
#include <span> // Para Span
|
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
|
|
||||||
#include "section.hpp" // Para Section::Name
|
#include "section.hpp" // Para Section::Name
|
||||||
@@ -25,7 +24,7 @@ class Credits;
|
|||||||
class Director {
|
class Director {
|
||||||
public:
|
public:
|
||||||
// --- Constructor y destructor ---
|
// --- Constructor y destructor ---
|
||||||
Director(int argc, std::span<char*> argv);
|
Director();
|
||||||
~Director();
|
~Director();
|
||||||
|
|
||||||
// --- Callbacks para SDL_MAIN_USE_CALLBACKS ---
|
// --- Callbacks para SDL_MAIN_USE_CALLBACKS ---
|
||||||
@@ -74,7 +73,6 @@ class Director {
|
|||||||
|
|
||||||
// --- Gestión de entrada y archivos ---
|
// --- Gestión de entrada y archivos ---
|
||||||
void loadAssets(); // Crea el índice de archivos disponibles
|
void loadAssets(); // Crea el índice de archivos disponibles
|
||||||
void checkProgramArguments(int argc, std::span<char*> argv); // Verifica los parámetros del programa // NOLINT(modernize-avoid-c-arrays)
|
|
||||||
|
|
||||||
// --- Gestión de secciones ---
|
// --- Gestión de secciones ---
|
||||||
void handleSectionTransition(); // Destruye la sección anterior y construye la nueva si Section::name ha cambiado
|
void handleSectionTransition(); // Destruye la sección anterior y construye la nueva si Section::name ha cambiado
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include <unordered_map> // Para unordered_map, _Node_iterator, operator==, _Node_iterator_base, _Node_const_iterator
|
#include <unordered_map> // Para unordered_map, _Node_iterator, operator==, _Node_iterator_base, _Node_const_iterator
|
||||||
#include <utility> // Para pair, move
|
#include <utility> // Para pair, move
|
||||||
|
|
||||||
|
|
||||||
// Singleton
|
// Singleton
|
||||||
Input* Input::instance = nullptr;
|
Input* Input::instance = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,10 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024
|
|||||||
#define SDL_MAIN_USE_CALLBACKS 1
|
#define SDL_MAIN_USE_CALLBACKS 1
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
|
||||||
#include <span> // Para span
|
|
||||||
|
|
||||||
#include "director.hpp" // Para Director
|
#include "director.hpp" // Para Director
|
||||||
|
|
||||||
SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) {
|
SDL_AppResult SDL_AppInit(void** appstate, int /*argc*/, char** /*argv*/) {
|
||||||
*appstate = new Director(argc, std::span<char*>(argv, argc));
|
*appstate = new Director();
|
||||||
return SDL_APP_CONTINUE;
|
return SDL_APP_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
|
|
||||||
#include "lang.hpp" // Para getText
|
#include "lang.hpp" // Para getText
|
||||||
|
|
||||||
// Variables
|
|
||||||
Overrides overrides = Overrides();
|
|
||||||
|
|
||||||
// Calcula el cuadrado de la distancia entre dos puntos
|
// Calcula el cuadrado de la distancia entre dos puntos
|
||||||
auto distanceSquared(int x1, int y1, int x2, int y2) -> double {
|
auto distanceSquared(int x1, int y1, int x2, int y2) -> double {
|
||||||
const int DELTA_X = x2 - x1;
|
const int DELTA_X = x2 - x1;
|
||||||
|
|||||||
@@ -12,13 +12,6 @@
|
|||||||
constexpr int BLOCK = 8;
|
constexpr int BLOCK = 8;
|
||||||
|
|
||||||
// --- Estructuras ---
|
// --- Estructuras ---
|
||||||
struct Overrides {
|
|
||||||
std::string param_file; // Fichero de parametros a utilizar
|
|
||||||
bool clear_hi_score_table{false}; // Reinicia la tabla de records
|
|
||||||
|
|
||||||
Overrides() = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Circle {
|
struct Circle {
|
||||||
int x, y, r; // Coordenadas y radio
|
int x, y, r; // Coordenadas y radio
|
||||||
Circle()
|
Circle()
|
||||||
@@ -41,9 +34,6 @@ struct Zone {
|
|||||||
float third_quarter_y; // Anclaje al 75% del eje Y
|
float third_quarter_y; // Anclaje al 75% del eje Y
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Variables ---
|
|
||||||
extern Overrides overrides; // Configuración global de overrides
|
|
||||||
|
|
||||||
// --- Funciones ---
|
// --- Funciones ---
|
||||||
|
|
||||||
// Colisiones y geometría
|
// Colisiones y geometría
|
||||||
|
|||||||
Reference in New Issue
Block a user