Arreglos varios al codi

This commit is contained in:
2024-10-08 22:38:58 +02:00
parent 3e3d764b25
commit bd3aa0bb06
30 changed files with 177 additions and 227 deletions

View File

@@ -2,7 +2,8 @@
#include "texture.h" // for Texture
// Constructor
Sprite::Sprite(int x, int y, int w, int h, Texture *texture) : x(x), y(y), w(w), h(h), texture(texture)
Sprite::Sprite(int x, int y, int w, int h, Texture *texture)
: x(x), y(y), w(w), h(h), texture(texture)
{
// Establece el rectangulo de donde coger la imagen
spriteClip = {0, 0, w, h};
@@ -11,7 +12,8 @@ Sprite::Sprite(int x, int y, int w, int h, Texture *texture) : x(x), y(y), w(w),
enabled = true;
}
Sprite::Sprite(SDL_Rect rect, Texture *texture): x(rect.x), y(rect.y), w(rect.w), h(rect.h), texture(texture)
Sprite::Sprite(SDL_Rect rect, Texture *texture)
: x(rect.x), y(rect.y), w(rect.w), h(rect.h), texture(texture)
{
// Establece el rectangulo de donde coger la imagen
spriteClip = {0, 0, w, h};
@@ -20,12 +22,6 @@ Sprite::Sprite(SDL_Rect rect, Texture *texture): x(rect.x), y(rect.y), w(rect.w)
enabled = true;
}
// Destructor
Sprite::~Sprite()
{
texture = nullptr;
}
// Muestra el sprite por pantalla
void Sprite::render()
{