migrant a SDL3

This commit is contained in:
2025-03-27 08:14:37 +01:00
parent a9c869baf6
commit d2286905dc
83 changed files with 570 additions and 541 deletions

View File

@@ -2,7 +2,7 @@
#include "texture.h" // Para Texture
// Constructor
Sprite::Sprite(std::shared_ptr<Texture> texture, int x, int y, int w, int h)
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}) {}
@@ -14,7 +14,7 @@ Sprite::Sprite(std::shared_ptr<Texture> texture, SDL_FRect rect)
Sprite::Sprite(std::shared_ptr<Texture> texture)
: texture_(texture),
pos_({0, 0, texture_->getWidth(), texture_->getHeight()}),
pos_(SDL_FRect{0, 0, static_cast<float>(texture_->getWidth()), static_cast<float>(texture_->getHeight())}),
sprite_clip_(pos_) {}
// Muestra el sprite por pantalla
@@ -24,14 +24,14 @@ void Sprite::render()
}
// Establece la posición del objeto
void Sprite::setPosition(int x, int y)
void Sprite::setPosition(float x, float y)
{
pos_.x = x;
pos_.y = y;
}
// Establece la posición del objeto
void Sprite::setPosition(SDL_Point p)
void Sprite::setPosition(SDL_FPoint p)
{
pos_.x = p.x;
pos_.y = p.y;