treballant en la consola
This commit is contained in:
59
source/game/ui/console.hpp
Normal file
59
source/game/ui/console.hpp
Normal 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
|
||||
};
|
||||
Reference in New Issue
Block a user