renombrades les clases SSprite a SurfaceSprite
This commit is contained in:
@@ -3,44 +3,44 @@
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
|
||||
// Constructor
|
||||
SSprite::SSprite(std::shared_ptr<Surface> surface, float x, float y, float w, float h)
|
||||
SurfaceSprite::SurfaceSprite(std::shared_ptr<Surface> surface, float x, float y, float w, float h)
|
||||
: surface_(surface),
|
||||
pos_((SDL_FRect){x, y, w, h}),
|
||||
clip_((SDL_FRect){0.0F, 0.0F, pos_.w, pos_.h}) {}
|
||||
|
||||
SSprite::SSprite(std::shared_ptr<Surface> surface, SDL_FRect rect)
|
||||
SurfaceSprite::SurfaceSprite(std::shared_ptr<Surface> surface, SDL_FRect rect)
|
||||
: surface_(surface),
|
||||
pos_(rect),
|
||||
clip_((SDL_FRect){0, 0, pos_.w, pos_.h}) {}
|
||||
|
||||
SSprite::SSprite(std::shared_ptr<Surface> surface)
|
||||
SurfaceSprite::SurfaceSprite(std::shared_ptr<Surface> surface)
|
||||
: surface_(surface),
|
||||
pos_((SDL_FRect){0.0F, 0.0F, surface_->getWidth(), surface_->getHeight()}),
|
||||
clip_(pos_) {}
|
||||
|
||||
// Muestra el sprite por pantalla
|
||||
void SSprite::render() {
|
||||
void SurfaceSprite::render() {
|
||||
surface_->render(pos_.x, pos_.y, &clip_);
|
||||
}
|
||||
|
||||
void SSprite::render(Uint8 source_color, Uint8 target_color) {
|
||||
void SurfaceSprite::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(float x, float y) {
|
||||
void SurfaceSprite::setPosition(float x, float y) {
|
||||
pos_.x = x;
|
||||
pos_.y = y;
|
||||
}
|
||||
|
||||
// Establece la posición del objeto
|
||||
void SSprite::setPosition(SDL_FPoint p) {
|
||||
void SurfaceSprite::setPosition(SDL_FPoint p) {
|
||||
pos_.x = p.x;
|
||||
pos_.y = p.y;
|
||||
}
|
||||
|
||||
// Reinicia las variables a cero
|
||||
void SSprite::clear() {
|
||||
void SurfaceSprite::clear() {
|
||||
pos_ = {0, 0, 0, 0};
|
||||
clip_ = {0, 0, 0, 0};
|
||||
}
|
||||
Reference in New Issue
Block a user