Retocat l'aspecte visual de les notificacions
This commit is contained in:
@@ -190,11 +190,12 @@ void Notifier::showText(std::string text1, std::string text2, int icon, std::str
|
||||
// Inicializa variables
|
||||
constexpr auto icon_size = 16;
|
||||
constexpr auto padding_out = 1;
|
||||
const auto padding_in = text_->getCharacterSize() / 2;
|
||||
const auto icon_space = icon >= 0 ? icon_size + padding_in : 0;
|
||||
const auto padding_in_h = text_->getCharacterSize();
|
||||
const auto padding_in_v = text_->getCharacterSize() / 2;
|
||||
const auto icon_space = icon >= 0 ? icon_size + padding_in_h : 0;
|
||||
const std::string txt = text1.length() > text2.length() ? text1 : text2;
|
||||
const auto width = text_->lenght(txt) + (padding_in * 2) + icon_space;
|
||||
const auto height = (text_->getCharacterSize() * num_texts) + (padding_in * 2);
|
||||
const auto width = text_->lenght(txt) + (padding_in_h * 2) + icon_space;
|
||||
const auto height = (text_->getCharacterSize() * num_texts) + (padding_in_v * 2);
|
||||
const auto shape = NotificationShape::SQUARED;
|
||||
|
||||
// Posición horizontal
|
||||
@@ -277,7 +278,7 @@ void Notifier::showText(std::string text1, std::string text2, int icon, std::str
|
||||
if (has_icons_ && icon >= 0 && num_texts == 2)
|
||||
{
|
||||
auto sp = std::make_unique<Sprite>((SDL_Rect){0, 0, icon_size, icon_size}, icon_texture_);
|
||||
sp->setPos({padding_in, padding_in, icon_size, icon_size});
|
||||
sp->setPos({padding_in_h, padding_in_v, icon_size, icon_size});
|
||||
sp->setSpriteClip({icon_size * (icon % 10), icon_size * (icon / 10), icon_size, icon_size});
|
||||
sp->render();
|
||||
}
|
||||
@@ -286,12 +287,12 @@ void Notifier::showText(std::string text1, std::string text2, int icon, std::str
|
||||
Color color = {255, 255, 255};
|
||||
if (num_texts == 2)
|
||||
{ // Dos lineas de texto
|
||||
text_->writeColored(padding_in + icon_space, padding_in, text1, color);
|
||||
text_->writeColored(padding_in + icon_space, padding_in + text_->getCharacterSize() + 1, text2, color);
|
||||
text_->writeColored(padding_in_h + icon_space, padding_in_v, text1, color);
|
||||
text_->writeColored(padding_in_h + icon_space, padding_in_v + text_->getCharacterSize() + 1, text2, color);
|
||||
}
|
||||
else
|
||||
{ // Una linea de texto
|
||||
text_->writeColored(padding_in + icon_space, padding_in, text1, color);
|
||||
text_->writeColored(padding_in_h + icon_space, padding_in_v, text1, color);
|
||||
}
|
||||
|
||||
// Deja de dibujar en la textura
|
||||
|
||||
Reference in New Issue
Block a user