canvi i reinici d'escene en la consola

This commit is contained in:
2026-03-28 00:02:14 +01:00
parent d39622c7e2
commit 7bad27d686
4 changed files with 121 additions and 20 deletions

View File

@@ -2,6 +2,7 @@
#include <SDL3/SDL.h>
#include <deque> // Para deque (historial)
#include <memory> // Para shared_ptr
#include <string> // Para string
@@ -43,9 +44,10 @@ class Console {
// Constantes de consola
static constexpr std::string_view CONSOLE_NAME = "JDD Console";
static constexpr std::string_view CONSOLE_VERSION = "v1.0";
static constexpr int MAX_LINE_CHARS = 28;
static constexpr float CURSOR_ON_TIME = 0.5F;
static constexpr float CURSOR_OFF_TIME = 0.3F;
static constexpr int MAX_LINE_CHARS = 28;
static constexpr int MAX_HISTORY_SIZE = 20;
static constexpr float CURSOR_ON_TIME = 0.5F;
static constexpr float CURSOR_OFF_TIME = 0.3F;
// [SINGLETON]
static Console* console;
@@ -74,4 +76,9 @@ class Console {
std::string input_line_;
float cursor_timer_{0.0F};
bool cursor_visible_{true};
// Historial de comandos (navegable con flechas arriba/abajo)
std::deque<std::string> history_;
int history_index_{-1}; // -1 = en la entrada actual (presente)
std::string saved_input_; // guarda input_line_ al empezar a navegar
};