forked from jaildesigner-jailgames/jaildoctors_dilemma
linter
This commit is contained in:
@@ -55,41 +55,41 @@ void Notifier::update() {
|
||||
// Si la notificación anterior está "saliendo", no hagas nada
|
||||
if (!notifications_.empty() && ¬ification != ¬ifications_.front()) {
|
||||
const auto& previous_notification = *(std::prev(¬ification));
|
||||
if (previous_notification.state == NotificationStatus::RISING) {
|
||||
if (previous_notification.state == Status::RISING) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (notification.state) {
|
||||
case NotificationStatus::RISING: {
|
||||
case Status::RISING: {
|
||||
const int DIRECTION = 1;
|
||||
notification.rect.y += DIRECTION;
|
||||
|
||||
if (notification.rect.y == notification.y) {
|
||||
notification.state = NotificationStatus::STAY;
|
||||
notification.state = Status::STAY;
|
||||
notification.start_time = SDL_GetTicks();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NotificationStatus::STAY: {
|
||||
case Status::STAY: {
|
||||
notification.elapsed_time = SDL_GetTicks() - notification.start_time;
|
||||
if (notification.elapsed_time >= notification.display_duration) {
|
||||
notification.state = NotificationStatus::VANISHING;
|
||||
notification.state = Status::VANISHING;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NotificationStatus::VANISHING: {
|
||||
case Status::VANISHING: {
|
||||
const int DIRECTION = -1;
|
||||
notification.rect.y += DIRECTION;
|
||||
|
||||
if (notification.rect.y == notification.y - notification.travel_dist) {
|
||||
notification.state = NotificationStatus::FINISHED;
|
||||
notification.state = Status::FINISHED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NotificationStatus::FINISHED:
|
||||
case Status::FINISHED:
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -106,7 +106,7 @@ void Notifier::update() {
|
||||
void Notifier::clearFinishedNotifications() {
|
||||
notifications_.erase(
|
||||
std::remove_if(notifications_.begin(), notifications_.end(), [](const Notification& notification) {
|
||||
return notification.state == NotificationStatus::FINISHED;
|
||||
return notification.state == Status::FINISHED;
|
||||
}),
|
||||
notifications_.end());
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
||||
text_is = ICON_SPACE > 0 ? NotificationText::LEFT : text_is;
|
||||
const float WIDTH = Options::game.width - (PADDING_OUT * 2);
|
||||
const float HEIGHT = (TEXT_SIZE * texts.size()) + (PADDING_IN_V * 2);
|
||||
const auto SHAPE = NotificationShape::SQUARED;
|
||||
const auto SHAPE = Shape::SQUARED;
|
||||
|
||||
// Posición horizontal
|
||||
float desp_h = ((Options::game.width / 2) - (WIDTH / 2));
|
||||
@@ -179,7 +179,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
||||
|
||||
// Dibuja el fondo de la notificación
|
||||
SDL_FRect rect;
|
||||
if (SHAPE == NotificationShape::ROUNDED) {
|
||||
if (SHAPE == Shape::ROUNDED) {
|
||||
rect = {4, 0, WIDTH - (4 * 2), HEIGHT};
|
||||
n.surface->fillRect(&rect, bg_color_);
|
||||
|
||||
@@ -193,7 +193,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
||||
n.surface->fillRect(&rect, bg_color_);
|
||||
}
|
||||
|
||||
else if (SHAPE == NotificationShape::SQUARED) {
|
||||
else if (SHAPE == Shape::SQUARED) {
|
||||
n.surface->clear(bg_color_);
|
||||
SDL_FRect squared_rect = {0, 0, n.surface->getWidth(), n.surface->getHeight()};
|
||||
n.surface->drawRectBorder(&squared_rect, static_cast<Uint8>(PaletteColor::CYAN));
|
||||
@@ -245,7 +245,7 @@ bool Notifier::isActive() { return !notifications_.empty(); }
|
||||
void Notifier::clearNotifications() {
|
||||
for (auto& notification : notifications_) {
|
||||
if (notification.can_be_removed) {
|
||||
notification.state = NotificationStatus::FINISHED;
|
||||
notification.state = Status::FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user