canvi de pc

This commit is contained in:
2025-02-24 08:52:11 +01:00
parent 5bb5be9c33
commit 48971cd5d1
14 changed files with 420 additions and 392 deletions

View File

@@ -5,12 +5,12 @@
MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, Texture *texture, SDL_Renderer *renderer)
{
// Copia los punteros
this->texture = texture;
this->renderer = renderer;
this->texture_ = texture;
this->renderer_ = renderer;
// Establece el alto y el ancho del sprite
this->w = w;
this->h = h;
this->w_ = w;
this->h_ = h;
// Establece la posición X,Y del sprite
this->x = x;
@@ -42,7 +42,7 @@ MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vel
counter = 0;
// Establece el rectangulo de donde coger la imagen
spriteClip = {0, 0, w, h};
clip_ = {0, 0, w, h};
// Establece el centro de rotación
center = nullptr;
@@ -81,7 +81,7 @@ void MovingSprite::clear()
// Mueve el sprite
void MovingSprite::move()
{
if (enabled)
if (enabled_)
{
xPrev = x;
yPrev = y;
@@ -97,9 +97,9 @@ void MovingSprite::move()
// Muestra el sprite por pantalla
void MovingSprite::render()
{
if (enabled)
if (enabled_)
{
texture->render(renderer, (int)x, (int)y, &spriteClip, zoomW, zoomH, angle, center, currentFlip);
texture_->render(renderer_, (int)x, (int)y, &clip_, zoomW, zoomH, angle, center, currentFlip);
}
}
@@ -162,8 +162,8 @@ void MovingSprite::setRect(SDL_Rect rect)
{
x = (float)rect.x;
y = (float)rect.y;
w = rect.w;
h = rect.h;
w_ = rect.w;
h_ = rect.h;
}
// Establece el valor de la variable
@@ -247,7 +247,7 @@ Uint16 MovingSprite::getRotateSpeed()
// Establece la rotacion
void MovingSprite::rotate()
{
if (enabled)
if (enabled_)
if (rotateEnabled)
{
if (counter % rotateSpeed == 0)
@@ -295,7 +295,7 @@ void MovingSprite::update()
move();
rotate();
if (enabled)
if (enabled_)
{
++counter %= 60000;
}
@@ -380,7 +380,7 @@ bool MovingSprite::getFlipV()
// Devuelve el rectangulo donde está el sprite
SDL_Rect MovingSprite::getRect()
{
const SDL_Rect rect = {(int)x, (int)y, w, h};
const SDL_Rect rect = {(int)x, (int)y, w_, h_};
return rect;
}