Afegit zoom a la classe Sprite
This commit is contained in:
@@ -19,31 +19,7 @@ Sprite::Sprite(std::shared_ptr<Texture> texture)
|
||||
// Muestra el sprite por pantalla
|
||||
void Sprite::render()
|
||||
{
|
||||
texture_->render(pos_.x, pos_.y, &sprite_clip_);
|
||||
}
|
||||
|
||||
// Obten el valor de la variable
|
||||
int Sprite::getX() const
|
||||
{
|
||||
return pos_.x;
|
||||
}
|
||||
|
||||
// Obten el valor de la variable
|
||||
int Sprite::getY() const
|
||||
{
|
||||
return pos_.y;
|
||||
}
|
||||
|
||||
// Obten el valor de la variable
|
||||
int Sprite::getWidth() const
|
||||
{
|
||||
return pos_.w;
|
||||
}
|
||||
|
||||
// Obten el valor de la variable
|
||||
int Sprite::getHeight() const
|
||||
{
|
||||
return pos_.h;
|
||||
texture_->render(pos_.x, pos_.y, &sprite_clip_, zoom_, zoom_);
|
||||
}
|
||||
|
||||
// Establece la posición del objeto
|
||||
@@ -60,84 +36,6 @@ void Sprite::setPosition(SDL_Point p)
|
||||
pos_.y = p.y;
|
||||
}
|
||||
|
||||
// Establece la posición del objeto
|
||||
void Sprite::setPosition(SDL_Rect r)
|
||||
{
|
||||
pos_ = r;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setX(int x)
|
||||
{
|
||||
pos_.x = x;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setY(int y)
|
||||
{
|
||||
pos_.y = y;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setWidth(int w)
|
||||
{
|
||||
pos_.w = w;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setHeight(int h)
|
||||
{
|
||||
pos_.h = h;
|
||||
}
|
||||
|
||||
// Obten el valor de la variable
|
||||
SDL_Rect Sprite::getSpriteClip() const
|
||||
{
|
||||
return sprite_clip_;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setSpriteClip(SDL_Rect rect)
|
||||
{
|
||||
sprite_clip_ = rect;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setSpriteClip(int x, int y, int w, int h)
|
||||
{
|
||||
sprite_clip_ = (SDL_Rect){x, y, w, h};
|
||||
}
|
||||
|
||||
// Obten el valor de la variable
|
||||
std::shared_ptr<Texture> Sprite::getTexture() const
|
||||
{
|
||||
return texture_;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Sprite::setTexture(std::shared_ptr<Texture> texture)
|
||||
{
|
||||
texture_ = texture;
|
||||
}
|
||||
|
||||
// Devuelve el rectangulo donde está el sprite
|
||||
SDL_Rect Sprite::getPosition() const
|
||||
{
|
||||
return pos_;
|
||||
}
|
||||
|
||||
// Incrementa el valor de la variable
|
||||
void Sprite::incX(int value)
|
||||
{
|
||||
pos_.x += value;
|
||||
}
|
||||
|
||||
// Incrementa el valor de la variable
|
||||
void Sprite::incY(int value)
|
||||
{
|
||||
pos_.y += value;
|
||||
}
|
||||
|
||||
// Reinicia las variables a cero
|
||||
void Sprite::clear()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user