migrat Notifier a time based

This commit is contained in:
2025-10-28 10:10:47 +01:00
parent de8c714132
commit 9e8c5e13df
7 changed files with 36 additions and 20 deletions

View File

@@ -8,6 +8,7 @@
class SurfaceSprite; // lines 8-8
class Surface; // lines 10-10
class Text; // lines 9-9
class DeltaTimer; // lines 11-11
// Constantes
constexpr Uint32 DEFAULT_NOTIFICATION_DURATION = 2000;
@@ -24,6 +25,7 @@ class Notifier {
// Constantes
static constexpr float ICON_SIZE = 16.0F;
static constexpr float PADDING_OUT = 0.0F;
static constexpr float SLIDE_SPEED = 120.0F; // Pixels per second for slide animations
// [SINGLETON] Objeto notifier
static Notifier* notifier;
@@ -60,8 +62,9 @@ class Notifier {
explicit Notification() = default;
};
std::shared_ptr<Surface> icon_surface_; // Textura para los iconos de las notificaciones
std::shared_ptr<Text> text_; // Objeto para dibujar texto
std::shared_ptr<Surface> icon_surface_; // Textura para los iconos de las notificaciones
std::shared_ptr<Text> text_; // Objeto para dibujar texto
std::unique_ptr<DeltaTimer> delta_timer_; // Timer for frame-independent animations
// Variables
Uint8 bg_color_; // Color de fondo de las notificaciones
@@ -97,7 +100,7 @@ class Notifier {
void render();
// Actualiza el estado de las notificaiones
void update();
void update(float delta_time);
// Muestra una notificación de texto por pantalla
void show(std::vector<std::string> texts, NotificationText text_is = NotificationText::LEFT, Uint32 display_duration = DEFAULT_NOTIFICATION_DURATION, int icon = -1, bool can_be_removed = true, const std::string& code = std::string());