netejant capçaleres

This commit is contained in:
2025-11-11 12:35:21 +01:00
parent 54fc6d2902
commit d6ced94316
14 changed files with 453 additions and 325 deletions
+10 -12
View File
@@ -6,22 +6,20 @@
// Constructor
SurfaceSprite::SurfaceSprite(std::shared_ptr<Surface> surface, float x, float y, float w, float h)
: surface_(std::move(std::move(surface))),
pos_((SDL_FRect){x, y, w, h}),
clip_((SDL_FRect){0.0F, 0.0F, pos_.w, pos_.h}) {}
: surface_(std::move(surface)),
pos_{x, y, w, h},
clip_{0.0F, 0.0F, pos_.w, pos_.h} {}
SurfaceSprite::SurfaceSprite(std::shared_ptr<Surface> surface, SDL_FRect rect)
: surface_(std::move(std::move(surface))),
: surface_(std::move(surface)),
pos_(rect),
clip_((SDL_FRect){0, 0, pos_.w, pos_.h}) {}
clip_{0.0F, 0.0F, pos_.w, pos_.h} {}
SurfaceSprite::SurfaceSprite()
: pos_((SDL_FRect){0.0F, 0.0F, 0.0F, 0.0F}),
clip_(pos_) {}
SurfaceSprite::SurfaceSprite() = default;
SurfaceSprite::SurfaceSprite(std::shared_ptr<Surface> surface)
: surface_(std::move(std::move(surface))),
pos_((SDL_FRect){0.0F, 0.0F, surface_->getWidth(), surface_->getHeight()}),
: surface_(std::move(surface)),
pos_{0.0F, 0.0F, surface_->getWidth(), surface_->getHeight()},
clip_(pos_) {}
// Muestra el sprite por pantalla
@@ -47,8 +45,8 @@ void SurfaceSprite::setPosition(SDL_FPoint p) {
// Reinicia las variables a cero
void SurfaceSprite::clear() {
pos_ = {.x = 0, .y = 0, .w = 0, .h = 0};
clip_ = {.x = 0, .y = 0, .w = 0, .h = 0};
pos_ = {0.0F, 0.0F, 0.0F, 0.0F};
clip_ = {0.0F, 0.0F, 0.0F, 0.0F};
}
// Actualiza el estado del sprite (time-based)