refactor
This commit is contained in:
@@ -29,14 +29,14 @@ void Item::update(float delta_time) {
|
||||
}
|
||||
|
||||
// Pinta el objeto en pantalla
|
||||
void Item::render() const { // NOLINT(readability-convert-member-functions-to-static)
|
||||
void Item::render() const {
|
||||
// Calcula el índice de color basado en el tiempo acumulado
|
||||
const int INDEX = static_cast<int>(time_accumulator_ / COLOR_CHANGE_INTERVAL) % static_cast<int>(color_.size());
|
||||
sprite_->render(1, color_.at(INDEX));
|
||||
}
|
||||
|
||||
// Obtiene su ubicación
|
||||
auto Item::getPos() -> SDL_FPoint { // NOLINT(readability-convert-member-functions-to-static)
|
||||
auto Item::getPos() -> SDL_FPoint {
|
||||
const SDL_FPoint P = {.x = sprite_->getX(), .y = sprite_->getY()};
|
||||
return P;
|
||||
}
|
||||
|
||||
@@ -637,7 +637,7 @@ auto Player::skinToAnimationPath(const std::string& skin_name) -> std::string {
|
||||
// Inicialización
|
||||
// ============================================================================
|
||||
|
||||
void Player::initSprite(const std::string& animations_path) { // NOLINT(readability-convert-member-functions-to-static)
|
||||
void Player::initSprite(const std::string& animations_path) {
|
||||
const auto& animation_data = Resource::Cache::get()->getAnimationData(animations_path);
|
||||
sprite_ = std::make_unique<AnimatedSprite>(animation_data);
|
||||
sprite_->setWidth(WIDTH);
|
||||
@@ -645,7 +645,7 @@ void Player::initSprite(const std::string& animations_path) { // NOLINT(readabi
|
||||
sprite_->setCurrentAnimation("walk");
|
||||
}
|
||||
|
||||
void Player::initSounds() { // NOLINT(readability-convert-member-functions-to-static)
|
||||
void Player::initSounds() {
|
||||
jump_sound_ = Resource::Cache::get()->getSound(Defaults::Sound::Files::JUMP);
|
||||
land_sound_ = Resource::Cache::get()->getSound(Defaults::Sound::Files::LAND);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user