forked from jaildesigner-jailgames/jaildoctors_dilemma
Modificadas las notificaciones a dos lineas de texto
This commit is contained in:
@@ -124,12 +124,13 @@ void Notify::clearFinishedNotifications()
|
||||
}
|
||||
|
||||
// Muestra una notificación de texto por pantalla;
|
||||
void Notify::showText(std::string text)
|
||||
void Notify::showText(std::string text1, std::string text2)
|
||||
{
|
||||
// Inicializa variables
|
||||
const int width = this->text->lenght(text) + (this->text->getCharacterSize() * 2);
|
||||
const int height = this->text->getCharacterSize() * 2;
|
||||
const int padding = (this->text->getCharacterSize() / 2);
|
||||
const std::string txt = text1.length() > text2.length() ? text1 : text2;
|
||||
const int width = text->lenght(txt) + text->getCharacterSize();
|
||||
const int height = text->getCharacterSize() * 3;
|
||||
const int padding = text->getCharacterSize() / 2;
|
||||
|
||||
// Posición horizontal
|
||||
int despH = 0;
|
||||
@@ -178,7 +179,7 @@ void Notify::showText(std::string text)
|
||||
n.travelDist = travelDist;
|
||||
n.counter = 0;
|
||||
n.state = ns_rising;
|
||||
n.text = text;
|
||||
n.text = text1;
|
||||
if (options->notifications.posV == pos_top)
|
||||
{
|
||||
n.rect = {despH, offset - travelDist, width, height};
|
||||
@@ -195,7 +196,15 @@ void Notify::showText(std::string text)
|
||||
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
n.texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
this->text->writeDX(TXT_CENTER | TXT_STROKE, width / 2, padding, text, 1, {255, 255, 255}, 1, {0, 0, 0});
|
||||
if (text2 != "")
|
||||
{ // Dos lineas de texto
|
||||
text->writeDX(TXT_STROKE, padding, padding, text1, 1, {255, 255, 255}, 1, {0, 0, 0});
|
||||
text->writeDX(TXT_STROKE, padding, padding + text->getCharacterSize() + 1, text2, 1, {255, 255, 255}, 1, {0, 0, 0});
|
||||
}
|
||||
else
|
||||
{ // Una linea de texto
|
||||
text->writeDX(TXT_STROKE, padding, (height / 2) - (text->getCharacterSize() / 2), text1, 1, {255, 255, 255}, 1, {0, 0, 0});
|
||||
}
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
|
||||
// Crea el sprite
|
||||
|
||||
Reference in New Issue
Block a user