This commit is contained in:
2025-10-19 22:01:31 +02:00
parent 16306f2325
commit 2b4523d644
101 changed files with 2058 additions and 1564 deletions

View File

@@ -1,5 +1,6 @@
#include "ui_message.hpp"
#include <algorithm>
#include <cmath> // Para pow
#include <utility>
@@ -20,7 +21,7 @@ void UIMessage::show() {
start_y_ = DESP; // Empieza 8 píxeles arriba de la posición base
target_y_ = 0.0F; // La posición final es la base
y_offset_ = start_y_;
animation_timer_ = 0.0f;
animation_timer_ = 0.0F;
animating_ = true;
visible_ = true;
}
@@ -33,7 +34,7 @@ void UIMessage::hide() {
start_y_ = y_offset_; // Comienza desde la posición actual
target_y_ = DESP; // Termina 8 píxeles arriba de la base
animation_timer_ = 0.0f;
animation_timer_ = 0.0F;
animating_ = true;
}
@@ -50,9 +51,7 @@ void UIMessage::updateAnimation(float delta_time) {
float t = animation_timer_ / ANIMATION_DURATION_S;
// Clamp t entre 0 y 1
if (t > 1.0f) {
t = 1.0f;
}
t = std::min(t, 1.0f);
if (target_y_ > start_y_) {
// Animación de entrada (ease out cubic)
@@ -67,7 +66,7 @@ void UIMessage::updateAnimation(float delta_time) {
if (animation_timer_ >= ANIMATION_DURATION_S) {
y_offset_ = target_y_;
animating_ = false;
animation_timer_ = 0.0f; // Reset timer
animation_timer_ = 0.0F; // Reset timer
if (target_y_ < 0.0F) {
visible_ = false;
}