diff --git a/source/game/ui/notifier.cpp b/source/game/ui/notifier.cpp index 00628b2..5528f26 100644 --- a/source/game/ui/notifier.cpp +++ b/source/game/ui/notifier.cpp @@ -31,7 +31,7 @@ void Notifier::destroy() { } // [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él -Notifier* Notifier::get() { +auto Notifier::get() -> Notifier* { return Notifier::notifier; } @@ -168,7 +168,7 @@ void Notifier::show(std::vector texts, NotificationText text_is, Ui n.shape = SHAPE; n.display_duration = display_duration; const float Y_POS = OFFSET + -TRAVEL_DIST; - n.rect = {desp_h, Y_POS, WIDTH, HEIGHT}; + n.rect = {.x = desp_h, .y = Y_POS, .w = WIDTH, .h = HEIGHT}; // Crea la textura n.surface = std::make_shared(WIDTH, HEIGHT); @@ -180,16 +180,16 @@ void Notifier::show(std::vector texts, NotificationText text_is, Ui // Dibuja el fondo de la notificación SDL_FRect rect; if (SHAPE == Shape::ROUNDED) { - rect = {4, 0, WIDTH - (4 * 2), HEIGHT}; + rect = {.x = 4, .y = 0, .w = WIDTH - (4 * 2), .h = HEIGHT}; n.surface->fillRect(&rect, bg_color_); - rect = {4 / 2, 1, WIDTH - 4, HEIGHT - 2}; + rect = {.x = 4 / 2, .y = 1, .w = WIDTH - 4, .h = HEIGHT - 2}; n.surface->fillRect(&rect, bg_color_); - rect = {1, 4 / 2, WIDTH - 2, HEIGHT - 4}; + rect = {.x = 1, .y = 4 / 2, .w = WIDTH - 2, .h = HEIGHT - 4}; n.surface->fillRect(&rect, bg_color_); - rect = {0, 4, WIDTH, HEIGHT - (4 * 2)}; + rect = {.x = 0, .y = 4, .w = WIDTH, .h = HEIGHT - (4 * 2)}; n.surface->fillRect(&rect, bg_color_); } @@ -208,7 +208,7 @@ void Notifier::show(std::vector texts, NotificationText text_is, Ui } // Escribe el texto de la notificación - const Uint8 COLOR = static_cast(PaletteColor::WHITE); + const auto COLOR = static_cast(PaletteColor::WHITE); int iterator = 0; for (const auto& text : texts) { switch (text_is) { @@ -239,7 +239,7 @@ void Notifier::show(std::vector texts, NotificationText text_is, Ui } // Indica si hay notificaciones activas -bool Notifier::isActive() { return !notifications_.empty(); } +auto Notifier::isActive() -> bool { return !notifications_.empty(); } // Finaliza y elimnina todas las notificaciones activas void Notifier::clearNotifications() { @@ -253,8 +253,9 @@ void Notifier::clearNotifications() { } // Obtiene los códigos de las notificaciones -std::vector Notifier::getCodes() { +auto Notifier::getCodes() -> std::vector { std::vector codes; + codes.reserve(notifications_.size()); for (const auto& notification : notifications_) { codes.emplace_back(notification.code); } diff --git a/source/game/ui/notifier.hpp b/source/game/ui/notifier.hpp index 0eacfc1..ef5019b 100644 --- a/source/game/ui/notifier.hpp +++ b/source/game/ui/notifier.hpp @@ -91,7 +91,7 @@ class Notifier { static void destroy(); // [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él - static Notifier* get(); + static auto get() -> Notifier*; // Dibuja las notificaciones por pantalla void render(); @@ -103,8 +103,8 @@ class Notifier { void show(std::vector 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()); // Indica si hay notificaciones activas - bool isActive(); + auto isActive() -> bool; // Obtiene los códigos de las notificaciones - std::vector getCodes(); + auto getCodes() -> std::vector; };