pasaeta loca de clang-format (despres m'arrepentiré pero bueno)
This commit is contained in:
@@ -1,46 +1,42 @@
|
||||
#include "sprite.h"
|
||||
|
||||
#include "texture.h" // Para Texture
|
||||
#include "texture.h" // Para Texture
|
||||
|
||||
// Constructor
|
||||
Sprite::Sprite(std::shared_ptr<Texture> texture, float x, float y, float w, float h)
|
||||
: texture_(texture),
|
||||
pos_((SDL_FRect){x, y, w, h}),
|
||||
sprite_clip_((SDL_FRect){0, 0, pos_.w, pos_.h}) {}
|
||||
: texture_(texture),
|
||||
pos_((SDL_FRect){x, y, w, h}),
|
||||
sprite_clip_((SDL_FRect){0, 0, pos_.w, pos_.h}) {}
|
||||
|
||||
Sprite::Sprite(std::shared_ptr<Texture> texture, SDL_FRect rect)
|
||||
: texture_(texture),
|
||||
pos_(rect),
|
||||
sprite_clip_((SDL_FRect){0, 0, pos_.w, pos_.h}) {}
|
||||
: texture_(texture),
|
||||
pos_(rect),
|
||||
sprite_clip_((SDL_FRect){0, 0, pos_.w, pos_.h}) {}
|
||||
|
||||
Sprite::Sprite(std::shared_ptr<Texture> texture)
|
||||
: texture_(texture),
|
||||
pos_(SDL_FRect{0, 0, static_cast<float>(texture_->getWidth()), static_cast<float>(texture_->getHeight())}),
|
||||
sprite_clip_(pos_) {}
|
||||
: texture_(texture),
|
||||
pos_(SDL_FRect{0, 0, static_cast<float>(texture_->getWidth()), static_cast<float>(texture_->getHeight())}),
|
||||
sprite_clip_(pos_) {}
|
||||
|
||||
// Muestra el sprite por pantalla
|
||||
void Sprite::render()
|
||||
{
|
||||
texture_->render(pos_.x, pos_.y, &sprite_clip_, zoom_, zoom_);
|
||||
void Sprite::render() {
|
||||
texture_->render(pos_.x, pos_.y, &sprite_clip_, zoom_, zoom_);
|
||||
}
|
||||
|
||||
// Establece la posición del objeto
|
||||
void Sprite::setPosition(float x, float y)
|
||||
{
|
||||
pos_.x = x;
|
||||
pos_.y = y;
|
||||
void Sprite::setPosition(float x, float y) {
|
||||
pos_.x = x;
|
||||
pos_.y = y;
|
||||
}
|
||||
|
||||
// Establece la posición del objeto
|
||||
void Sprite::setPosition(SDL_FPoint p)
|
||||
{
|
||||
pos_.x = p.x;
|
||||
pos_.y = p.y;
|
||||
void Sprite::setPosition(SDL_FPoint p) {
|
||||
pos_.x = p.x;
|
||||
pos_.y = p.y;
|
||||
}
|
||||
|
||||
// Reinicia las variables a cero
|
||||
void Sprite::clear()
|
||||
{
|
||||
pos_ = {0, 0, 0, 0};
|
||||
sprite_clip_ = {0, 0, 0, 0};
|
||||
void Sprite::clear() {
|
||||
pos_ = {0, 0, 0, 0};
|
||||
sprite_clip_ = {0, 0, 0, 0};
|
||||
}
|
||||
Reference in New Issue
Block a user