migrant a SDL3
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_Point
|
||||
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint
|
||||
#include <memory> // Para shared_ptr
|
||||
class Texture;
|
||||
|
||||
@@ -16,7 +17,7 @@ protected:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Sprite(std::shared_ptr<Texture>, int x, int y, int w, int h);
|
||||
Sprite(std::shared_ptr<Texture>, float x, float y, float w, float h);
|
||||
Sprite(std::shared_ptr<Texture>, SDL_FRect rect);
|
||||
explicit Sprite(std::shared_ptr<Texture>);
|
||||
|
||||
@@ -30,39 +31,39 @@ public:
|
||||
virtual void clear();
|
||||
|
||||
// Obtiene la posición y el tamaño
|
||||
int getX() const { return pos_.x; }
|
||||
int getY() const { return pos_.y; }
|
||||
int getWidth() const { return pos_.w; }
|
||||
int getHeight() const { return pos_.h; }
|
||||
float getX() const { return pos_.x; }
|
||||
float getY() const { return pos_.y; }
|
||||
float getWidth() const { return pos_.w; }
|
||||
float getHeight() const { return pos_.h; }
|
||||
|
||||
// Devuelve el rectangulo donde está el sprite
|
||||
SDL_FRect getPosition() const { return pos_; }
|
||||
SDL_FRect &getRect() { return pos_; }
|
||||
|
||||
// Establece la posición y el tamaño
|
||||
void setX(int x) { pos_.x = x; }
|
||||
void setY(int y) { pos_.y = y; }
|
||||
void setWidth(int w) { pos_.w = w; }
|
||||
void setHeight(int h) { pos_.h = h; }
|
||||
void setX(float x) { pos_.x = x; }
|
||||
void setY(float y) { pos_.y = y; }
|
||||
void setWidth(float w) { pos_.w = w; }
|
||||
void setHeight(float h) { pos_.h = h; }
|
||||
|
||||
// Establece la posición del objeto
|
||||
void setPosition(int x, int y);
|
||||
void setPosition(SDL_Point p);
|
||||
void setPosition(float x, float y);
|
||||
void setPosition(SDL_FPoint p);
|
||||
void setPosition(SDL_FRect r) { pos_ = r; }
|
||||
|
||||
// Establece el nivel de zoom
|
||||
void setZoom(float zoom) { zoom_ = zoom; }
|
||||
|
||||
// Aumenta o disminuye la posición
|
||||
void incX(int value) { pos_.x += value; }
|
||||
void incY(int value) { pos_.y += value; }
|
||||
void incX(float value) { pos_.x += value; }
|
||||
void incY(float value) { pos_.y += value; }
|
||||
|
||||
// Obtiene el rectangulo que se dibuja de la textura
|
||||
SDL_FRect getSpriteClip() const { return sprite_clip_; }
|
||||
|
||||
// Establece el rectangulo que se dibuja de la textura
|
||||
void setSpriteClip(SDL_FRect rect) { sprite_clip_ = rect; }
|
||||
void setSpriteClip(int x, int y, int w, int h) { sprite_clip_ = (SDL_FRect){x, y, w, h}; }
|
||||
void setSpriteClip(float x, float y, float w, float h) { sprite_clip_ = (SDL_FRect){x, y, w, h}; }
|
||||
|
||||
// Obtiene un puntero a la textura
|
||||
std::shared_ptr<Texture> getTexture() const { return texture_; }
|
||||
|
||||
Reference in New Issue
Block a user