eliminat soport per a arguments

This commit is contained in:
2026-04-14 13:09:54 +02:00
parent cf7ea6cc9c
commit 4ac34b8583
17 changed files with 53 additions and 100 deletions

View File

@@ -5,11 +5,9 @@
#include <cstdlib> // Para srand, exit, rand, EXIT_FAILURE
#include <ctime> // Para time
#include <filesystem> // Para path, absolute
#include <fstream> // Para ifstream, ofstream
#include <iostream> // Para basic_ostream, operator<<, cerr
#include <memory> // Para make_unique, unique_ptr
#include <span> // Para span
#include <stdexcept> // Para runtime_error
#include <string> // Para allocator, basic_string, char_traits, operator+, string, operator==
@@ -38,10 +36,9 @@
#include "system_utils.hpp" // Para createApplicationFolder, resultToString, Result
#include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.hpp" // Para Overrides, overrides
// Constructor
Director::Director(int argc, std::span<char*> argv) {
Director::Director() {
Section::attract_mode = Section::AttractMode::TITLE_TO_DEMO;
// 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";
// Comprueba los parametros del programa
checkProgramArguments(argc, argv);
// Obtener la ruta del ejecutable desde SDL
const char* base_path = SDL_GetBasePath();
executable_path_ = (base_path != nullptr) ? base_path : "";
// Crea la carpeta del sistema donde guardar los datos persistentes
createSystemFolder("jailgames");
@@ -173,11 +171,7 @@ void Director::loadScoreFile() {
#ifdef _DEBUG
manager->clear();
#else
if (overrides.clear_hi_score_table) {
manager->clear();
} else {
manager->loadFromFile(Asset::get()->getPath("score.bin"));
}
#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)
void Director::loadDebugConfig() {
const std::string DEBUG_FILE = system_folder_ + "/debug.yaml";

View File

@@ -3,7 +3,6 @@
#include <SDL3/SDL.h> // Para SDL_AppResult, SDL_Event
#include <memory> // Para unique_ptr
#include <span> // Para Span
#include <string> // Para string
#include "section.hpp" // Para Section::Name
@@ -25,7 +24,7 @@ class Credits;
class Director {
public:
// --- Constructor y destructor ---
Director(int argc, std::span<char*> argv);
Director();
~Director();
// --- Callbacks para SDL_MAIN_USE_CALLBACKS ---
@@ -74,7 +73,6 @@ class Director {
// --- Gestión de entrada y archivos ---
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 ---
void handleSectionTransition(); // Destruye la sección anterior y construye la nueva si Section::name ha cambiado

View File

@@ -8,7 +8,6 @@
#include <unordered_map> // Para unordered_map, _Node_iterator, operator==, _Node_iterator_base, _Node_const_iterator
#include <utility> // Para pair, move
// Singleton
Input* Input::instance = nullptr;

View File

@@ -10,12 +10,10 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024
#define SDL_MAIN_USE_CALLBACKS 1
#include <SDL3/SDL_main.h>
#include <span> // Para span
#include "director.hpp" // Para Director
SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) {
*appstate = new Director(argc, std::span<char*>(argv, argc));
SDL_AppResult SDL_AppInit(void** appstate, int /*argc*/, char** /*argv*/) {
*appstate = new Director();
return SDL_APP_CONTINUE;
}

View File

@@ -14,9 +14,6 @@
#include "lang.hpp" // Para getText
// Variables
Overrides overrides = Overrides();
// Calcula el cuadrado de la distancia entre dos puntos
auto distanceSquared(int x1, int y1, int x2, int y2) -> double {
const int DELTA_X = x2 - x1;

View File

@@ -12,13 +12,6 @@
constexpr int BLOCK = 8;
// --- 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 {
int x, y, r; // Coordenadas y radio
Circle()
@@ -41,9 +34,6 @@ struct Zone {
float third_quarter_y; // Anclaje al 75% del eje Y
};
// --- Variables ---
extern Overrides overrides; // Configuración global de overrides
// --- Funciones ---
// Colisiones y geometría