corregits mes includes

llevats els errors en texture
This commit is contained in:
2025-10-15 09:14:30 +02:00
parent 78c5333144
commit 7c102e42cc
63 changed files with 1122 additions and 1621 deletions

View File

@@ -1,50 +1,46 @@
#include "s_sprite.h"
#include "surface.h" // Para Surface
#include "sprite/surface_sprite.h"
#include "surface.h" // Para Surface
// Constructor
SSprite::SSprite(std::shared_ptr<Surface> surface, int x, int y, int w, int h)
: surface_(surface),
pos_((SDL_Rect){x, y, w, h}),
clip_((SDL_Rect){0, 0, pos_.w, pos_.h}) {}
: surface_(surface),
pos_((SDL_Rect){x, y, w, h}),
clip_((SDL_Rect){0, 0, pos_.w, pos_.h}) {}
SSprite::SSprite(std::shared_ptr<Surface> surface, SDL_Rect rect)
: surface_(surface),
pos_(rect),
clip_((SDL_Rect){0, 0, pos_.w, pos_.h}) {}
: surface_(surface),
pos_(rect),
clip_((SDL_Rect){0, 0, pos_.w, pos_.h}) {}
SSprite::SSprite(std::shared_ptr<Surface> surface)
: surface_(surface),
pos_({0, 0, surface_->getWidth(), surface_->getHeight()}),
clip_(pos_) {}
: surface_(surface),
pos_({0, 0, surface_->getWidth(), surface_->getHeight()}),
clip_(pos_) {}
// Muestra el sprite por pantalla
void SSprite::render()
{
surface_->render(pos_.x, pos_.y, &clip_);
void SSprite::render() {
surface_->render(pos_.x, pos_.y, &clip_);
}
void SSprite::render(Uint8 source_color, Uint8 target_color)
{
surface_->renderWithColorReplace(pos_.x, pos_.y, source_color, target_color, &clip_);
void SSprite::render(Uint8 source_color, Uint8 target_color) {
surface_->renderWithColorReplace(pos_.x, pos_.y, source_color, target_color, &clip_);
}
// Establece la posición del objeto
void SSprite::setPosition(int x, int y)
{
pos_.x = x;
pos_.y = y;
void SSprite::setPosition(int x, int y) {
pos_.x = x;
pos_.y = y;
}
// Establece la posición del objeto
void SSprite::setPosition(SDL_Point p)
{
pos_.x = p.x;
pos_.y = p.y;
void SSprite::setPosition(SDL_Point p) {
pos_.x = p.x;
pos_.y = p.y;
}
// Reinicia las variables a cero
void SSprite::clear()
{
pos_ = {0, 0, 0, 0};
clip_ = {0, 0, 0, 0};
void SSprite::clear() {
pos_ = {0, 0, 0, 0};
clip_ = {0, 0, 0, 0};
}