linter
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <SDL3/SDL.h> // Para SDL_SetTextureScaleMode, SDL_FlipMode, SDL_ScaleMode
|
||||
|
||||
#include <algorithm> // Para max
|
||||
#include <string> // Para basic_string
|
||||
|
||||
#include "animated_sprite.hpp" // Para AnimatedSprite
|
||||
#include "audio.hpp" // Para Audio
|
||||
@@ -15,8 +16,8 @@
|
||||
#include "texture.hpp" // Para Texture
|
||||
|
||||
constexpr int ZOOM_FACTOR = 5;
|
||||
constexpr float FLASH_DELAY_S = 0.05f; // 3 frames → 0.05s
|
||||
constexpr float FLASH_DURATION_S = 0.1f; // 6 frames → 0.1s (3 + 3)
|
||||
constexpr float FLASH_DELAY_S = 0.05F; // 3 frames → 0.05s
|
||||
constexpr float FLASH_DURATION_S = 0.1F; // 6 frames → 0.1s (3 + 3)
|
||||
constexpr Color FLASH_COLOR = Color(0xFF, 0xFF, 0xFF); // Color blanco para el flash
|
||||
|
||||
// Constructor
|
||||
@@ -46,7 +47,7 @@ void GameLogo::init() {
|
||||
arcade_edition_status_ = Status::DISABLED;
|
||||
shake_.init(1, 2, 8, XP);
|
||||
zoom_ = 3.0F * ZOOM_FACTOR;
|
||||
post_finished_timer_ = 0.0f;
|
||||
post_finished_timer_ = 0.0F;
|
||||
|
||||
// Inicializa el bitmap de 'Coffee'
|
||||
coffee_sprite_->setPosX(XP);
|
||||
@@ -59,7 +60,7 @@ void GameLogo::init() {
|
||||
coffee_sprite_->setAccelY(COFFEE_ACCEL_Y);
|
||||
coffee_sprite_->setSpriteClip(0, 0, coffee_texture_->getWidth(), coffee_texture_->getHeight());
|
||||
coffee_sprite_->setEnabled(true);
|
||||
coffee_sprite_->setFinishedDelay(0.0f);
|
||||
coffee_sprite_->setFinishedDelay(0.0F);
|
||||
coffee_sprite_->setDestX(XP);
|
||||
coffee_sprite_->setDestY(y_ - coffee_texture_->getHeight());
|
||||
|
||||
@@ -74,7 +75,7 @@ void GameLogo::init() {
|
||||
crisis_sprite_->setAccelY(CRISIS_ACCEL_Y);
|
||||
crisis_sprite_->setSpriteClip(0, 0, crisis_texture_->getWidth(), crisis_texture_->getHeight());
|
||||
crisis_sprite_->setEnabled(true);
|
||||
crisis_sprite_->setFinishedDelay(0.0f);
|
||||
crisis_sprite_->setFinishedDelay(0.0F);
|
||||
crisis_sprite_->setDestX(XP + CRISIS_OFFSET_X);
|
||||
crisis_sprite_->setDestY(y_);
|
||||
|
||||
@@ -115,44 +116,44 @@ void GameLogo::render() {
|
||||
}
|
||||
|
||||
// Actualiza la lógica de la clase (time-based)
|
||||
void GameLogo::update(float deltaTime) {
|
||||
updateCoffeeCrisis(deltaTime);
|
||||
updateArcadeEdition(deltaTime);
|
||||
updatePostFinishedCounter(deltaTime);
|
||||
void GameLogo::update(float delta_time) {
|
||||
updateCoffeeCrisis(delta_time);
|
||||
updateArcadeEdition(delta_time);
|
||||
updatePostFinishedCounter(delta_time);
|
||||
}
|
||||
|
||||
void GameLogo::updateCoffeeCrisis(float deltaTime) {
|
||||
void GameLogo::updateCoffeeCrisis(float delta_time) {
|
||||
switch (coffee_crisis_status_) {
|
||||
case Status::MOVING:
|
||||
handleCoffeeCrisisMoving(deltaTime);
|
||||
handleCoffeeCrisisMoving(delta_time);
|
||||
break;
|
||||
case Status::SHAKING:
|
||||
handleCoffeeCrisisShaking(deltaTime);
|
||||
handleCoffeeCrisisShaking(delta_time);
|
||||
break;
|
||||
case Status::FINISHED:
|
||||
handleCoffeeCrisisFinished(deltaTime);
|
||||
handleCoffeeCrisisFinished(delta_time);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GameLogo::updateArcadeEdition(float deltaTime) {
|
||||
void GameLogo::updateArcadeEdition(float delta_time) {
|
||||
switch (arcade_edition_status_) {
|
||||
case Status::MOVING:
|
||||
handleArcadeEditionMoving(deltaTime);
|
||||
handleArcadeEditionMoving(delta_time);
|
||||
break;
|
||||
case Status::SHAKING:
|
||||
handleArcadeEditionShaking(deltaTime);
|
||||
handleArcadeEditionShaking(delta_time);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GameLogo::handleCoffeeCrisisMoving(float deltaTime) {
|
||||
coffee_sprite_->update(deltaTime);
|
||||
crisis_sprite_->update(deltaTime);
|
||||
void GameLogo::handleCoffeeCrisisMoving(float delta_time) {
|
||||
coffee_sprite_->update(delta_time);
|
||||
crisis_sprite_->update(delta_time);
|
||||
|
||||
if (coffee_sprite_->hasFinished() && crisis_sprite_->hasFinished()) {
|
||||
coffee_crisis_status_ = Status::SHAKING;
|
||||
@@ -160,23 +161,23 @@ void GameLogo::handleCoffeeCrisisMoving(float deltaTime) {
|
||||
}
|
||||
}
|
||||
|
||||
void GameLogo::handleCoffeeCrisisShaking(float deltaTime) {
|
||||
void GameLogo::handleCoffeeCrisisShaking(float delta_time) {
|
||||
if (shake_.remaining > 0) {
|
||||
processShakeEffect(coffee_sprite_.get(), crisis_sprite_.get(), deltaTime);
|
||||
processShakeEffect(coffee_sprite_.get(), crisis_sprite_.get(), delta_time);
|
||||
} else {
|
||||
finishCoffeeCrisisShaking();
|
||||
}
|
||||
|
||||
updateDustSprites(deltaTime);
|
||||
updateDustSprites(delta_time);
|
||||
}
|
||||
|
||||
void GameLogo::handleCoffeeCrisisFinished(float deltaTime) {
|
||||
updateDustSprites(deltaTime);
|
||||
void GameLogo::handleCoffeeCrisisFinished(float delta_time) {
|
||||
updateDustSprites(delta_time);
|
||||
}
|
||||
|
||||
void GameLogo::handleArcadeEditionMoving(float deltaTime) {
|
||||
void GameLogo::handleArcadeEditionMoving(float delta_time) {
|
||||
// DeltaTime en segundos: decremento por segundo
|
||||
zoom_ -= (ZOOM_DECREMENT_PER_S * ZOOM_FACTOR) * deltaTime;
|
||||
zoom_ -= (ZOOM_DECREMENT_PER_S * ZOOM_FACTOR) * delta_time;
|
||||
arcade_edition_sprite_->setZoom(zoom_);
|
||||
|
||||
if (zoom_ <= 1.0F) {
|
||||
@@ -184,17 +185,17 @@ void GameLogo::handleArcadeEditionMoving(float deltaTime) {
|
||||
}
|
||||
}
|
||||
|
||||
void GameLogo::handleArcadeEditionShaking(float deltaTime) {
|
||||
void GameLogo::handleArcadeEditionShaking(float delta_time) {
|
||||
if (shake_.remaining > 0) {
|
||||
processArcadeEditionShake(deltaTime);
|
||||
processArcadeEditionShake(delta_time);
|
||||
} else {
|
||||
arcade_edition_sprite_->setX(shake_.origin);
|
||||
arcade_edition_status_ = Status::FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
void GameLogo::processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite, float deltaTime) {
|
||||
shake_.time_accumulator += deltaTime;
|
||||
void GameLogo::processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite, float delta_time) {
|
||||
shake_.time_accumulator += delta_time;
|
||||
|
||||
if (shake_.time_accumulator >= SHAKE_DELAY_S) {
|
||||
shake_.time_accumulator -= SHAKE_DELAY_S;
|
||||
@@ -207,14 +208,14 @@ void GameLogo::processShakeEffect(SmartSprite* primary_sprite, SmartSprite* seco
|
||||
}
|
||||
}
|
||||
|
||||
void GameLogo::processArcadeEditionShake(float deltaTime) {
|
||||
void GameLogo::processArcadeEditionShake(float delta_time) {
|
||||
// Delay fijo en segundos (shake_.delay era frames, ahora usamos constante)
|
||||
float delayTime = SHAKE_DELAY_S;
|
||||
float delay_time = SHAKE_DELAY_S;
|
||||
|
||||
shake_.time_accumulator += deltaTime;
|
||||
shake_.time_accumulator += delta_time;
|
||||
|
||||
if (shake_.time_accumulator >= delayTime) {
|
||||
shake_.time_accumulator -= delayTime;
|
||||
if (shake_.time_accumulator >= delay_time) {
|
||||
shake_.time_accumulator -= delay_time;
|
||||
const auto DISPLACEMENT = calculateShakeDisplacement();
|
||||
arcade_edition_sprite_->setX(shake_.origin + DISPLACEMENT);
|
||||
shake_.remaining--;
|
||||
@@ -246,15 +247,15 @@ void GameLogo::playTitleEffects() {
|
||||
Screen::get()->shake();
|
||||
}
|
||||
|
||||
void GameLogo::updateDustSprites(float deltaTime) {
|
||||
dust_right_sprite_->update(deltaTime);
|
||||
dust_left_sprite_->update(deltaTime);
|
||||
void GameLogo::updateDustSprites(float delta_time) {
|
||||
dust_right_sprite_->update(delta_time);
|
||||
dust_left_sprite_->update(delta_time);
|
||||
}
|
||||
|
||||
void GameLogo::updatePostFinishedCounter(float deltaTime) {
|
||||
void GameLogo::updatePostFinishedCounter(float delta_time) {
|
||||
if (coffee_crisis_status_ == Status::FINISHED &&
|
||||
arcade_edition_status_ == Status::FINISHED) {
|
||||
post_finished_timer_ += deltaTime;
|
||||
post_finished_timer_ += delta_time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user