balloon: readability-function-cognitive-complexity
balloon: eliminat l'efecte de rebot per als globos mes xicotets moving_sprite: canviats variables i metodes zoomW a horizontal_zoom i zoomH a vertical_zoom
This commit is contained in:
@@ -8,8 +8,8 @@ MovingSprite::MovingSprite(std::shared_ptr<Texture> texture, SDL_FRect pos, Rota
|
||||
x_(pos.x),
|
||||
y_(pos.y),
|
||||
rotate_(rotate),
|
||||
zoom_w_(zoom_w),
|
||||
zoom_h_(zoom_h),
|
||||
horizontal_zoom_(zoom_w),
|
||||
vertical_zoom_(zoom_h),
|
||||
flip_(flip) {}
|
||||
|
||||
MovingSprite::MovingSprite(std::shared_ptr<Texture> texture, SDL_FRect pos)
|
||||
@@ -17,15 +17,15 @@ MovingSprite::MovingSprite(std::shared_ptr<Texture> texture, SDL_FRect pos)
|
||||
x_(pos.x),
|
||||
y_(pos.y),
|
||||
|
||||
zoom_w_(1.0F),
|
||||
zoom_h_(1.0F),
|
||||
horizontal_zoom_(1.0F),
|
||||
vertical_zoom_(1.0F),
|
||||
flip_(SDL_FLIP_NONE) {}
|
||||
|
||||
MovingSprite::MovingSprite(std::shared_ptr<Texture> texture)
|
||||
: Sprite(texture),
|
||||
|
||||
zoom_w_(1.0F),
|
||||
zoom_h_(1.0F),
|
||||
horizontal_zoom_(1.0F),
|
||||
vertical_zoom_(1.0F),
|
||||
flip_(SDL_FLIP_NONE) { Sprite::clear(); }
|
||||
|
||||
// Reinicia todas las variables
|
||||
@@ -41,8 +41,8 @@ void MovingSprite::clear() {
|
||||
|
||||
rotate_ = Rotate(); // Inicializa la estructura
|
||||
|
||||
zoom_w_ = 1.0F; // Zoom aplicado a la anchura
|
||||
zoom_h_ = 1.0F; // Zoom aplicado a la altura
|
||||
horizontal_zoom_ = 1.0F; // Zoom aplicado a la anchura
|
||||
vertical_zoom_ = 1.0F; // Zoom aplicado a la altura
|
||||
|
||||
flip_ = SDL_FLIP_NONE; // Establece como se ha de voltear el sprite
|
||||
|
||||
@@ -68,7 +68,7 @@ void MovingSprite::update() {
|
||||
}
|
||||
|
||||
// Muestra el sprite por pantalla
|
||||
void MovingSprite::render() { texture_->render(pos_.x, pos_.y, &sprite_clip_, zoom_w_, zoom_h_, rotate_.angle, &rotate_.center, flip_); }
|
||||
void MovingSprite::render() { texture_->render(pos_.x, pos_.y, &sprite_clip_, horizontal_zoom_, vertical_zoom_, rotate_.angle, &rotate_.center, flip_); }
|
||||
|
||||
// Establece la rotacion
|
||||
void MovingSprite::rotate() {
|
||||
|
||||
Reference in New Issue
Block a user