ja es pot escriure en la consola

This commit is contained in:
2026-03-27 22:54:47 +01:00
parent f25ee18329
commit e85800c5ed
5 changed files with 125 additions and 21 deletions

View File

@@ -20,9 +20,11 @@ class Console {
void update(float delta_time);
void render();
void toggle();
void handleEvent(const SDL_Event& event);
// Consultas
auto isActive() -> bool; // true si RISING, ACTIVE o VANISHING
auto isActive() -> bool; // true si RISING, ACTIVE o VANISHING
auto getVisibleHeight() -> int; // Píxeles visibles actuales (0 = oculta, height_ = totalmente visible)
private:
enum class Status {
@@ -35,8 +37,14 @@ class Console {
// Constantes visuales
static constexpr Uint8 BG_COLOR = 0; // PaletteColor::BLACK
static constexpr Uint8 BORDER_COLOR = 9; // PaletteColor::BRIGHT_GREEN
static constexpr Uint8 MSG_COLOR = 8; // PaletteColor::GREEN
static constexpr float SLIDE_SPEED = 120.0F;
// Constantes de entrada
static constexpr int MAX_INPUT_CHARS = 28;
static constexpr float CURSOR_ON_TIME = 0.5F;
static constexpr float CURSOR_OFF_TIME = 0.3F;
// [SINGLETON]
static Console* console;
@@ -45,7 +53,9 @@ class Console {
~Console() = default;
// Métodos privados
void buildSurface(); // Crea la Surface con el aspecto visual
void buildSurface(); // Crea la Surface con el aspecto visual
void redrawText(); // Redibuja el texto dinámico (msg + input + cursor)
void processCommand(); // Procesa el comando introducido por el usuario
// Objetos de renderizado
std::shared_ptr<Text> text_;
@@ -56,4 +66,10 @@ class Console {
Status status_{Status::HIDDEN};
float y_{0.0F}; // Posición Y actual (animada)
float height_{0.0F}; // Altura del panel
// Estado de la entrada de texto
std::string msg_line_{"JDD CONSOLE V1.0"};
std::string input_line_;
float cursor_timer_{0.0F};
bool cursor_visible_{true};
};