linter
This commit is contained in:
@@ -2,17 +2,16 @@
|
||||
|
||||
#include <SDL3/SDL.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError, SDL_FRect
|
||||
|
||||
#include <algorithm> // Para min, max
|
||||
#include <algorithm> // Para min
|
||||
#include <cstddef> // Para size_t
|
||||
#include <fstream> // Para basic_istream, basic_ifstream, basic_ios, ifstream, stringstream
|
||||
#include <sstream> // Para basic_stringstream
|
||||
#include <fstream> // Para basic_istream, basic_ifstream, istream, basic_ios, ifstream, istringstream, stringstream
|
||||
#include <sstream> // Para basic_istringstream, basic_stringstream
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <utility> // Para pair
|
||||
#include <utility> // Para move, pair
|
||||
|
||||
#include "resource_helper.hpp" // Para ResourceHelper
|
||||
#include "resource_helper.hpp" // Para loadFile
|
||||
#include "texture.hpp" // Para Texture
|
||||
#include "utils.hpp" // Para printWithDots
|
||||
#include "ui/logger.hpp"
|
||||
#include "ui/logger.hpp" // Para dots
|
||||
|
||||
// Carga las animaciones en un vector(Animations) desde un fichero
|
||||
auto loadAnimationsFromFile(const std::string& file_path) -> AnimationsFileBuffer {
|
||||
@@ -88,13 +87,13 @@ auto AnimatedSprite::getAnimationIndex(const std::string& name) -> int {
|
||||
}
|
||||
|
||||
// Calcula el frame correspondiente a la animación (time-based)
|
||||
void AnimatedSprite::animate(float deltaTime) {
|
||||
void AnimatedSprite::animate(float delta_time) {
|
||||
if (animations_[current_animation_].speed == 0 || animations_[current_animation_].paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Acumular tiempo transcurrido
|
||||
animations_[current_animation_].time_accumulator += deltaTime;
|
||||
animations_[current_animation_].time_accumulator += delta_time;
|
||||
|
||||
// Verificar si es momento de cambiar frame
|
||||
if (animations_[current_animation_].time_accumulator >= animations_[current_animation_].speed) {
|
||||
@@ -107,7 +106,7 @@ void AnimatedSprite::animate(float deltaTime) {
|
||||
animations_[current_animation_].current_frame = animations_[current_animation_].frames.size() - 1;
|
||||
animations_[current_animation_].completed = true;
|
||||
} else { // Si hay loop, vuelve al frame indicado
|
||||
animations_[current_animation_].time_accumulator = 0.0f;
|
||||
animations_[current_animation_].time_accumulator = 0.0F;
|
||||
animations_[current_animation_].current_frame = animations_[current_animation_].loop;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +129,7 @@ void AnimatedSprite::setCurrentAnimation(const std::string& name, bool reset) {
|
||||
current_animation_ = NEW_ANIMATION;
|
||||
if (reset) {
|
||||
animations_[current_animation_].current_frame = 0;
|
||||
animations_[current_animation_].time_accumulator = 0.0f;
|
||||
animations_[current_animation_].time_accumulator = 0.0F;
|
||||
animations_[current_animation_].completed = false;
|
||||
} else {
|
||||
animations_[current_animation_].current_frame = std::min(animations_[OLD_ANIMATION].current_frame, animations_[current_animation_].frames.size() - 1);
|
||||
@@ -149,7 +148,7 @@ void AnimatedSprite::setCurrentAnimation(int index, bool reset) {
|
||||
current_animation_ = NEW_ANIMATION;
|
||||
if (reset) {
|
||||
animations_[current_animation_].current_frame = 0;
|
||||
animations_[current_animation_].time_accumulator = 0.0f;
|
||||
animations_[current_animation_].time_accumulator = 0.0F;
|
||||
animations_[current_animation_].completed = false;
|
||||
} else {
|
||||
animations_[current_animation_].current_frame = std::min(animations_[OLD_ANIMATION].current_frame, animations_[current_animation_].frames.size());
|
||||
@@ -161,15 +160,15 @@ void AnimatedSprite::setCurrentAnimation(int index, bool reset) {
|
||||
}
|
||||
|
||||
// Actualiza las variables del objeto (time-based)
|
||||
void AnimatedSprite::update(float deltaTime) {
|
||||
animate(deltaTime);
|
||||
MovingSprite::update(deltaTime);
|
||||
void AnimatedSprite::update(float delta_time) {
|
||||
animate(delta_time);
|
||||
MovingSprite::update(delta_time);
|
||||
}
|
||||
|
||||
// Reinicia la animación
|
||||
void AnimatedSprite::resetAnimation() {
|
||||
animations_[current_animation_].current_frame = 0;
|
||||
animations_[current_animation_].time_accumulator = 0.0f;
|
||||
animations_[current_animation_].time_accumulator = 0.0F;
|
||||
animations_[current_animation_].completed = false;
|
||||
animations_[current_animation_].paused = false;
|
||||
updateSpriteClip();
|
||||
|
||||
Reference in New Issue
Block a user