#pragma once #include #include "text.h" #include "texture.h" #include "sprite.h" #include "utils.h" #include #ifndef NOTIFY_H #define NOTIFY_H class Notify { private: enum notification_state_e { ns_rising, ns_stay, ns_vanishing, ns_finished }; enum notification_position_e { upperLeft, upperCenter, upperRight, middleLeft, middleRight, bottomLeft, bottomCenter, bottomRight }; struct notification_t { std::string text; int counter; notification_state_e state; notification_position_e position; Texture *texture; Sprite *sprite; SDL_Rect rect; int y; int travelDist; }; // Objetos y punteros SDL_Renderer *renderer; // El renderizador de la ventana Texture *texture; // Textura para la fuente de las notificaciones Text *text; // Objeto para dibujar texto // Variables color_t bgColor; // Color de fondo de las notificaciones int waitTime; // Tiempo que se ve la notificación std::vector notifications; // La lista de notificaciones activas // Elimina las notificaciones finalizadas void clearFinishedNotifications(); public: // Dibuja las notificaciones por pantalla void render(); // Actualiza el estado de las notificaiones void update(); // Constructor Notify(SDL_Renderer *renderer, std::string bitmapFile, std::string textFile); // Destructor ~Notify(); // Muestra una notificación de texto por pantalla; void showText(std::string text); // Indica si hay notificaciones activas bool active(); }; #endif