Retocat un poc el disseny de Title

Retocades les notificacions
This commit is contained in:
2025-03-06 23:12:53 +01:00
parent ff309168ef
commit 9eaf3bc134
4 changed files with 17 additions and 14 deletions

View File

@@ -183,12 +183,14 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
}
// Inicializa variables
const auto PADDING_IN_H = text_->getCharacterSize();
const auto PADDING_IN_V = text_->getCharacterSize() / 2;
//const int text_size = text_->getCharacterSize();
const int text_size = 6;
const auto PADDING_IN_H = text_size;
const auto PADDING_IN_V = text_size / 2;
const int ICON_SPACE = icon >= 0 ? ICON_SIZE_ + PADDING_IN_H : 0;
text_is = ICON_SPACE > 0 ? NotificationText::LEFT : text_is;
const int WIDTH = options.game.width - (PADDING_OUT_ * 2);
const int HEIGHT = (text_->getCharacterSize() * texts.size()) + (PADDING_IN_V * 2);
const int HEIGHT = (text_size * texts.size()) + (PADDING_IN_V * 2);
const auto SHAPE = NotificationShape::SQUARED;
// Posición horizontal
@@ -237,7 +239,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
n.surface = std::make_shared<Surface>(WIDTH, HEIGHT);
// Prepara para dibujar en la textura
auto previuos_renderer = Screen::get()->getRendererSurface();
auto previuos_renderer = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(n.surface);
// Dibuja el fondo de la notificación
@@ -260,6 +262,8 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
else if (SHAPE == NotificationShape::SQUARED)
{
n.surface->clear(bg_color_);
SDL_Rect rect = {0, 0, n.surface->getWidth(), n.surface->getHeight()};
n.surface->drawRectBorder(&rect, static_cast<Uint8>(PaletteColor::RED));
}
// Dibuja el icono de la notificación
@@ -272,17 +276,17 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, in
}
// Escribe el texto de la notificación
const Uint8 COLOR = stringToColor("white");
const Uint8 COLOR = static_cast<Uint8>(PaletteColor::WHITE);
int iterator = 0;
for (const auto &text : texts)
{
switch (text_is)
{
case NotificationText::LEFT:
text_->writeColored(PADDING_IN_H + ICON_SPACE, PADDING_IN_V + iterator * (text_->getCharacterSize() + 1), text, COLOR);
text_->writeColored(PADDING_IN_H + ICON_SPACE, PADDING_IN_V + iterator * (text_size + 1), text, COLOR);
break;
case NotificationText::CENTER:
text_->writeDX(TEXT_CENTER | TEXT_COLOR, WIDTH / 2, PADDING_IN_V + iterator * (text_->getCharacterSize() + 1), text, 1, COLOR);
text_->writeDX(TEXT_CENTER | TEXT_COLOR, WIDTH / 2, PADDING_IN_V + iterator * (text_size + 1), text, 1, COLOR);
break;
default:
break;