forked from jaildesigner-jailgames/jaildoctors_dilemma
afegits estils per a les notificacions (per a distinguir les de sistema de les dels logros)
This commit is contained in:
@@ -12,16 +12,34 @@ class DeltaTimer; // lines 11-11
|
||||
|
||||
class Notifier {
|
||||
public:
|
||||
// Constantes
|
||||
static constexpr Uint32 DURATION_DEFAULT = 2000;
|
||||
static constexpr Uint32 DURATION_CHEEVO = 4000;
|
||||
|
||||
// Justificado para las notificaciones
|
||||
enum class TextAlign {
|
||||
LEFT,
|
||||
CENTER,
|
||||
};
|
||||
|
||||
// Forma de las notificaciones
|
||||
enum class Shape {
|
||||
ROUNDED,
|
||||
SQUARED,
|
||||
};
|
||||
|
||||
// Estilo de notificación
|
||||
struct Style {
|
||||
Uint8 bg_color; // Color de fondo
|
||||
Uint8 border_color; // Color del borde
|
||||
Uint8 text_color; // Color del texto
|
||||
Shape shape; // Forma (ROUNDED/SQUARED)
|
||||
TextAlign text_align; // Alineación del texto
|
||||
float duration; // Duración en segundos
|
||||
std::string sound_file; // Archivo de sonido (vacío = sin sonido)
|
||||
bool play_sound; // Si reproduce sonido
|
||||
|
||||
// Estilos predefinidos
|
||||
static const Style DEFAULT;
|
||||
static const Style CHEEVO;
|
||||
};
|
||||
|
||||
// Gestión singleton
|
||||
static void init(const std::string& icon_file, const std::string& text); // Inicialización
|
||||
static void destroy(); // Destrucción
|
||||
@@ -32,8 +50,7 @@ class Notifier {
|
||||
void update(float delta_time); // Actualización lógica
|
||||
void show(
|
||||
std::vector<std::string> texts,
|
||||
TextAlign text_is = TextAlign::LEFT,
|
||||
Uint32 display_duration = DURATION_DEFAULT,
|
||||
const Style& style = Style::DEFAULT,
|
||||
int icon = -1,
|
||||
bool can_be_removed = true,
|
||||
const std::string& code = std::string()); // Mostrar notificación
|
||||
@@ -51,11 +68,6 @@ class Notifier {
|
||||
FINISHED,
|
||||
};
|
||||
|
||||
enum class Shape {
|
||||
ROUNDED,
|
||||
SQUARED,
|
||||
};
|
||||
|
||||
struct Notification {
|
||||
std::shared_ptr<Surface> surface{nullptr};
|
||||
std::shared_ptr<SurfaceSprite> sprite{nullptr};
|
||||
@@ -68,9 +80,8 @@ class Notifier {
|
||||
std::string code{};
|
||||
bool can_be_removed{true};
|
||||
int height{0};
|
||||
Uint32 start_time{0};
|
||||
Uint32 elapsed_time{0};
|
||||
Uint32 display_duration{0};
|
||||
float elapsed_time{0.0f};
|
||||
float display_duration{0.0f};
|
||||
};
|
||||
|
||||
// Constantes
|
||||
@@ -93,7 +104,6 @@ class Notifier {
|
||||
std::shared_ptr<Surface> icon_surface_; // Textura para los iconos
|
||||
std::shared_ptr<Text> text_; // Objeto para dibujar texto
|
||||
std::unique_ptr<DeltaTimer> delta_timer_; // Timer for frame-independent animations
|
||||
Uint8 bg_color_{0}; // Color de fondo de las notificaciones
|
||||
std::vector<Notification> notifications_; // Lista de notificaciones activas
|
||||
bool stack_{false}; // Indica si las notificaciones se apilan
|
||||
bool has_icons_{false}; // Indica si el notificador tiene textura para iconos
|
||||
|
||||
Reference in New Issue
Block a user