forked from jaildesigner-jailgames/jaildoctors_dilemma
Reestructurant la classe Options
This commit is contained in:
@@ -106,11 +106,11 @@ void Notifier::update()
|
||||
const float step = ((float)notifications_[i].counter / notifications_[i].travelDist);
|
||||
const int alpha = 255 * step;
|
||||
|
||||
if (options.notifications.posV == pos_top)
|
||||
if (options.notifications.getVerticalPosition() == "UPPER")
|
||||
{
|
||||
notifications_[i].rect.y++;
|
||||
}
|
||||
else
|
||||
else if (options.notifications.getVerticalPosition() == "BOTTOM")
|
||||
{
|
||||
notifications_[i].rect.y--;
|
||||
}
|
||||
@@ -138,11 +138,11 @@ void Notifier::update()
|
||||
const float step = (notifications_[i].counter / (float)notifications_[i].travelDist);
|
||||
const int alpha = 255 * (1 - step);
|
||||
|
||||
if (options.notifications.posV == pos_top)
|
||||
if (options.notifications.getVerticalPosition() == "UPPER")
|
||||
{
|
||||
notifications_[i].rect.y--;
|
||||
}
|
||||
else
|
||||
else if (options.notifications.getVerticalPosition() == "BOTTOM")
|
||||
{
|
||||
notifications_[i].rect.y++;
|
||||
}
|
||||
@@ -187,41 +187,41 @@ void Notifier::show(std::string text1, std::string text2, int icon)
|
||||
|
||||
// Posición horizontal
|
||||
int despH = 0;
|
||||
if (options.notifications.posH == pos_left)
|
||||
if (options.notifications.getHorizontalPosition() == "LEFT")
|
||||
{
|
||||
despH = padding;
|
||||
}
|
||||
else if (options.notifications.posH == pos_middle)
|
||||
else if (options.notifications.getHorizontalPosition() == "CENTER")
|
||||
{
|
||||
despH = ((options.screen.windowWidth * options.windowSize) / 2 - (width / 2));
|
||||
despH = (options.game.width - width) / 2;
|
||||
}
|
||||
else
|
||||
else if (options.notifications.getHorizontalPosition() == "RIGHT")
|
||||
{
|
||||
despH = (options.screen.windowWidth * options.windowSize) - width - padding;
|
||||
despH = options.game.width - width - padding;
|
||||
}
|
||||
|
||||
// Posición vertical
|
||||
int despV = 0;
|
||||
if (options.notifications.posV == pos_top)
|
||||
if (options.notifications.getVerticalPosition() == "UPPER")
|
||||
{
|
||||
despV = padding;
|
||||
}
|
||||
else
|
||||
{
|
||||
despV = (options.screen.windowHeight * options.windowSize) - height - padding;
|
||||
despV = options.game.height - height - padding;
|
||||
}
|
||||
|
||||
const int travelDist = height + padding;
|
||||
|
||||
// Offset
|
||||
int offset = 0;
|
||||
if (options.notifications.posV == pos_top)
|
||||
if (options.notifications.getVerticalPosition() == "UPPER")
|
||||
{
|
||||
offset = (int)notifications_.size() > 0 ? notifications_.back().y + travelDist : despV;
|
||||
offset = static_cast<int>(notifications_.size()) > 0 ? notifications_.back().y + travelDist : despV;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = (int)notifications_.size() > 0 ? notifications_.back().y - travelDist : despV;
|
||||
offset = static_cast<int>(notifications_.size()) > 0 ? notifications_.back().y - travelDist : despV;
|
||||
}
|
||||
|
||||
// Crea la notificacion
|
||||
@@ -234,7 +234,7 @@ void Notifier::show(std::string text1, std::string text2, int icon)
|
||||
n.state = ns_rising;
|
||||
n.text1 = text1;
|
||||
n.text2 = text2;
|
||||
if (options.notifications.posV == pos_top)
|
||||
if (options.notifications.getVerticalPosition() == "UPPER")
|
||||
{
|
||||
n.rect = {despH, offset - travelDist, width, height};
|
||||
}
|
||||
@@ -277,7 +277,7 @@ void Notifier::show(std::string text1, std::string text2, int icon)
|
||||
}
|
||||
|
||||
// Escribe el texto de la notificación
|
||||
color_t color = {255, 255, 255};
|
||||
Color color = {255, 255, 255};
|
||||
if (text2 != "")
|
||||
{ // Dos lineas de texto
|
||||
text_->writeColored(padding + iconSpace, padding, text1, color);
|
||||
|
||||
Reference in New Issue
Block a user