treballant en la consola

This commit is contained in:
2026-03-27 22:24:55 +01:00
parent 3712f0c8d9
commit f25ee18329
8 changed files with 218 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
#pragma once
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
#include <string> // Para string
class Surface;
class Sprite;
class Text;
class Console {
public:
// Singleton
static void init(const std::string& font_name);
static void destroy();
static auto get() -> Console*;
// Métodos principales
void update(float delta_time);
void render();
void toggle();
// Consultas
auto isActive() -> bool; // true si RISING, ACTIVE o VANISHING
private:
enum class Status {
HIDDEN,
RISING,
ACTIVE,
VANISHING,
};
// Constantes visuales
static constexpr Uint8 BG_COLOR = 0; // PaletteColor::BLACK
static constexpr Uint8 BORDER_COLOR = 9; // PaletteColor::BRIGHT_GREEN
static constexpr float SLIDE_SPEED = 120.0F;
// [SINGLETON]
static Console* console;
// Constructor y destructor privados [SINGLETON]
explicit Console(const std::string& font_name);
~Console() = default;
// Métodos privados
void buildSurface(); // Crea la Surface con el aspecto visual
// Objetos de renderizado
std::shared_ptr<Text> text_;
std::shared_ptr<Surface> surface_;
std::shared_ptr<Sprite> sprite_;
// Estado de la animación
Status status_{Status::HIDDEN};
float y_{0.0F}; // Posición Y actual (animada)
float height_{0.0F}; // Altura del panel
};