Console ara llig els comandos desde un fitxer extern

This commit is contained in:
2026-04-01 19:31:09 +02:00
parent f9c1c4843d
commit ec9a9aff81
7 changed files with 1247 additions and 902 deletions

View File

@@ -6,9 +6,10 @@
#include <functional> // Para function
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <unordered_map> // Para unordered_map (tab_completions_)
#include <vector> // Para vector
#include "game/ui/console_commands.hpp" // Para CommandRegistry
class Surface;
class Sprite;
class Text;
@@ -100,7 +101,9 @@ class Console {
std::string saved_input_; // guarda input_line_ al empezar a navegar
// Estado de autocompletado (TAB)
std::vector<std::string> tab_matches_; // Comandos que coinciden con el prefijo actual
int tab_index_{-1}; // Índice actual en tab_matches_
std::unordered_map<std::string, std::vector<std::string>> tab_completions_; // Mapa pre-calculado en constructor
std::vector<std::string> tab_matches_; // Comandos que coinciden con el prefijo actual
int tab_index_{-1}; // Índice actual en tab_matches_
// Registro de comandos (metadatos YAML + handlers C++)
CommandRegistry registry_;
};