linter
This commit is contained in:
@@ -43,8 +43,8 @@ class Screen {
|
||||
void initShaders(); // Inicializa los shaders
|
||||
|
||||
// --- Efectos visuales ---
|
||||
void shake(int desp = 2, float delay_s = 0.05f, float duration_s = 0.133f) { shake_effect_.enable(src_rect_, dst_rect_, desp, delay_s, duration_s); } // Agita la pantalla (tiempo en segundos)
|
||||
void flash(Color color, float duration_s = 0.167f, float delay_s = 0.0f) { flash_effect_ = FlashEffect(true, duration_s, delay_s, color); } // Pone la pantalla de color (tiempo en segundos)
|
||||
void shake(int desp = 2, float delay_s = 0.05F, float duration_s = 0.133F) { shake_effect_.enable(src_rect_, dst_rect_, desp, delay_s, duration_s); } // Agita la pantalla (tiempo en segundos)
|
||||
void flash(Color color, float duration_s = 0.167F, float delay_s = 0.0F) { flash_effect_ = FlashEffect(true, duration_s, delay_s, color); } // Pone la pantalla de color (tiempo en segundos)
|
||||
void toggleShaders(); // Alterna entre activar y desactivar los shaders
|
||||
void toggleIntegerScale(); // Alterna entre activar y desactivar el escalado entero
|
||||
void toggleVSync(); // Alterna entre activar y desactivar el V-Sync
|
||||
@@ -107,7 +107,7 @@ class Screen {
|
||||
float timer_s; // Timer en segundos (contador decreciente)
|
||||
Color color; // Color del flash
|
||||
|
||||
explicit FlashEffect(bool enabled = false, float duration_s = 0.0f, float delay_s = 0.0f, Color color = Color(0xFF, 0xFF, 0xFF))
|
||||
explicit FlashEffect(bool enabled = false, float duration_s = 0.0F, float delay_s = 0.0F, Color color = Color(0xFF, 0xFF, 0xFF))
|
||||
: enabled(enabled),
|
||||
duration_s(duration_s),
|
||||
delay_s(delay_s),
|
||||
@@ -115,9 +115,9 @@ class Screen {
|
||||
color(color) {}
|
||||
|
||||
void update(float delta_time) {
|
||||
if (enabled && timer_s > 0.0f) {
|
||||
if (enabled && timer_s > 0.0F) {
|
||||
timer_s -= delta_time;
|
||||
if (timer_s <= 0.0f) {
|
||||
if (timer_s <= 0.0F) {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class Screen {
|
||||
int original_width; // Ancho original de la imagen
|
||||
bool enabled; // Indica si el efecto está activo
|
||||
|
||||
explicit ShakeEffect(bool en = false, int dp = 2, float dl_s = 0.05f, float cnt_s = 0.0f, float len_s = 0.133f, float rem_s = 0.0f, int orig_pos = 0, int orig_width = 800)
|
||||
explicit ShakeEffect(bool en = false, int dp = 2, float dl_s = 0.05F, float cnt_s = 0.0F, float len_s = 0.133F, float rem_s = 0.0F, int orig_pos = 0, int orig_width = 800)
|
||||
: desp(dp),
|
||||
delay_s(dl_s),
|
||||
counter_s(cnt_s),
|
||||
@@ -147,7 +147,7 @@ class Screen {
|
||||
enabled(en) {}
|
||||
|
||||
// Activa el efecto de sacudida y guarda la posición y tamaño originales
|
||||
void enable(SDL_FRect& src_rect, SDL_FRect& dst_rect, int new_desp = -1, float new_delay_s = -1.0f, float new_duration_s = -1.0f) {
|
||||
void enable(SDL_FRect& src_rect, SDL_FRect& dst_rect, int new_desp = -1, float new_delay_s = -1.0F, float new_duration_s = -1.0F) {
|
||||
if (!enabled) {
|
||||
enabled = true;
|
||||
original_pos = src_rect.x;
|
||||
@@ -157,10 +157,10 @@ class Screen {
|
||||
if (new_desp != -1) {
|
||||
desp = new_desp;
|
||||
}
|
||||
if (new_delay_s >= 0.0f) {
|
||||
if (new_delay_s >= 0.0F) {
|
||||
delay_s = new_delay_s;
|
||||
}
|
||||
if (new_duration_s >= 0.0f) {
|
||||
if (new_duration_s >= 0.0F) {
|
||||
duration_s = new_duration_s;
|
||||
}
|
||||
|
||||
@@ -175,17 +175,17 @@ class Screen {
|
||||
void update(SDL_FRect& src_rect, SDL_FRect& dst_rect, float delta_time) {
|
||||
if (enabled) {
|
||||
counter_s -= delta_time;
|
||||
if (counter_s <= 0.0f) {
|
||||
if (counter_s <= 0.0F) {
|
||||
counter_s = delay_s;
|
||||
// Alternar desplazamiento basado en tiempo restante
|
||||
const bool SHAKE_LEFT = static_cast<int>(remaining_s * 30.0f) % 2 == 0; // ~30 cambios por segundo
|
||||
const bool SHAKE_LEFT = static_cast<int>(remaining_s * 30.0F) % 2 == 0; // ~30 cambios por segundo
|
||||
const auto SRC_DESP = SHAKE_LEFT ? 0 : desp;
|
||||
const auto DST_DESP = SHAKE_LEFT ? desp : 0;
|
||||
src_rect.x = original_pos + SRC_DESP;
|
||||
dst_rect.x = original_pos + DST_DESP;
|
||||
|
||||
remaining_s -= delay_s;
|
||||
if (remaining_s <= 0.0f) {
|
||||
if (remaining_s <= 0.0F) {
|
||||
enabled = false;
|
||||
src_rect.x = original_pos;
|
||||
src_rect.w = original_width;
|
||||
|
||||
Reference in New Issue
Block a user