linter
This commit is contained in:
@@ -44,7 +44,7 @@ inline void error(const std::string& msg) {
|
||||
}
|
||||
|
||||
// CR
|
||||
inline void CR() {
|
||||
inline void cr() {
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ inline void CR() {
|
||||
inline void dots(const std::string& prefix,
|
||||
const std::string& middle,
|
||||
const std::string& suffix,
|
||||
const std::string& suffixColor = GREEN) {
|
||||
const std::string& suffix_color = GREEN) {
|
||||
size_t field_width = TOTAL_WIDTH > (prefix.size() + suffix.size())
|
||||
? TOTAL_WIDTH - prefix.size() - suffix.size()
|
||||
: 0;
|
||||
@@ -65,7 +65,7 @@ inline void dots(const std::string& prefix,
|
||||
}
|
||||
|
||||
std::cout << " " << prefix << field_text
|
||||
<< suffixColor << suffix << RESET
|
||||
<< suffix_color << suffix << RESET
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "menu_option.hpp"
|
||||
|
||||
#include <algorithm> // Para find
|
||||
#include <algorithm> // Para max
|
||||
#include <iterator> // Para distance
|
||||
#include <memory> // Para allocator
|
||||
#include <ranges> // Para __find_fn, find
|
||||
|
||||
#include "text.hpp" // Para Text
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ void Notifier::processNotification(int index, float delta_time) {
|
||||
|
||||
void Notifier::playNotificationSoundIfNeeded(const Notification& notification) {
|
||||
// Hace sonar la notificación al inicio
|
||||
if (notification.timer <= 0.016f &&
|
||||
if (notification.timer <= 0.016F &&
|
||||
param.notification.sound &&
|
||||
notification.state == State::RISING) {
|
||||
Audio::get()->playSound("notify.wav", Audio::Group::INTERFACE);
|
||||
@@ -99,7 +99,7 @@ void Notifier::handleRisingState(int index, float delta_time) {
|
||||
|
||||
const float PIXELS_TO_MOVE = ANIMATION_SPEED_PX_PER_S * delta_time;
|
||||
const float PROGRESS = notification.timer * ANIMATION_SPEED_PX_PER_S / notification.travel_dist;
|
||||
const int ALPHA = static_cast<int>(255 * std::min(PROGRESS, 1.0f));
|
||||
const int ALPHA = static_cast<int>(255 * std::min(PROGRESS, 1.0F));
|
||||
|
||||
moveNotificationVertically(notification, param.notification.pos_v == Position::TOP ? PIXELS_TO_MOVE : -PIXELS_TO_MOVE);
|
||||
notification.texture->setAlpha(ALPHA);
|
||||
@@ -115,7 +115,7 @@ void Notifier::handleStayState(int index) {
|
||||
|
||||
if (notification.timer >= STAY_DURATION_S) {
|
||||
notification.state = State::VANISHING;
|
||||
notification.timer = 0.0f;
|
||||
notification.timer = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,12 +124,12 @@ void Notifier::handleVanishingState(int index, float delta_time) {
|
||||
|
||||
const float PIXELS_TO_MOVE = ANIMATION_SPEED_PX_PER_S * delta_time;
|
||||
const float PROGRESS = notification.timer * ANIMATION_SPEED_PX_PER_S / notification.travel_dist;
|
||||
const int ALPHA = static_cast<int>(255 * (1 - std::min(PROGRESS, 1.0f)));
|
||||
const int ALPHA = static_cast<int>(255 * (1 - std::min(PROGRESS, 1.0F)));
|
||||
|
||||
moveNotificationVertically(notification, param.notification.pos_v == Position::TOP ? -PIXELS_TO_MOVE : PIXELS_TO_MOVE);
|
||||
notification.texture->setAlpha(ALPHA);
|
||||
|
||||
if (PROGRESS >= 1.0f) {
|
||||
if (PROGRESS >= 1.0F) {
|
||||
notification.state = State::FINISHED;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void Notifier::transitionToStayState(int index) {
|
||||
notification.state = State::STAY;
|
||||
notification.texture->setAlpha(255);
|
||||
notification.rect.y = static_cast<float>(notification.y); // Asegurar posición exacta
|
||||
notification.timer = 0.0f;
|
||||
notification.timer = 0.0F;
|
||||
}
|
||||
|
||||
// Elimina las notificaciones finalizadas
|
||||
|
||||
@@ -42,8 +42,8 @@ class Notifier {
|
||||
|
||||
private:
|
||||
// --- Constantes de tiempo (en segundos) ---
|
||||
static constexpr float STAY_DURATION_S = 2.5f; // Tiempo que se ve la notificación (150 frames @ 60fps)
|
||||
static constexpr float ANIMATION_SPEED_PX_PER_S = 60.0f; // Velocidad de animación (1 pixel/frame @ 60fps)
|
||||
static constexpr float STAY_DURATION_S = 2.5F; // Tiempo que se ve la notificación (150 frames @ 60fps)
|
||||
static constexpr float ANIMATION_SPEED_PX_PER_S = 60.0F; // Velocidad de animación (1 pixel/frame @ 60fps)
|
||||
|
||||
// --- Enums privados ---
|
||||
enum class State {
|
||||
@@ -67,7 +67,7 @@ class Notifier {
|
||||
std::string code; // Código identificador de la notificación
|
||||
State state{State::RISING}; // Estado de la notificación
|
||||
Shape shape{Shape::SQUARED}; // Forma de la notificación
|
||||
float timer{0.0f}; // Timer en segundos
|
||||
float timer{0.0F}; // Timer en segundos
|
||||
int y{0}; // Posición vertical
|
||||
int travel_dist{0}; // Distancia a recorrer
|
||||
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
|
||||
#include <cstddef> // Para size_t
|
||||
#include <functional> // Para function
|
||||
#include <iterator> // Para pair
|
||||
#include <memory> // Para unique_ptr
|
||||
#include <string> // Para string
|
||||
#include <string> // Para basic_string, string
|
||||
#include <utility> // Para pair
|
||||
#include <vector> // Para vector
|
||||
|
||||
#include "define_buttons.hpp" // Para DefineButtons
|
||||
#include "ui_message.hpp" // Para UIMessage
|
||||
#include "define_buttons.hpp" // for DefineButtons
|
||||
#include "ui_message.hpp" // for UIMessage
|
||||
|
||||
class MenuOption;
|
||||
class MenuRenderer;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class UIMessage {
|
||||
float start_y_ = 0.0F; // Posición Y inicial de la animación
|
||||
float target_y_ = 0.0F; // Posición Y objetivo de la animación
|
||||
float animation_timer_ = 0.0F; // Timer actual de la animación en segundos
|
||||
static constexpr float ANIMATION_DURATION_S = 0.133f; // Duración total de la animación (8 frames @ 60fps)
|
||||
static constexpr float ANIMATION_DURATION_S = 0.133F; // Duración total de la animación (8 frames @ 60fps)
|
||||
static constexpr float DESP = -8.0F; // Distancia a desplazarse
|
||||
|
||||
// Actualiza la interpolación de la animación (ease out/in cubic)
|
||||
|
||||
Reference in New Issue
Block a user