neteja tidy a source/core i encamina Texture::loadFromFile pel ResourceHelper
This commit is contained in:
@@ -12,31 +12,22 @@ MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vel
|
||||
vx(velx),
|
||||
vy(vely),
|
||||
ax(accelx),
|
||||
ay(accely),
|
||||
zoomW(1),
|
||||
zoomH(1),
|
||||
angle(0.0),
|
||||
rotateEnabled(false),
|
||||
rotateSpeed(0),
|
||||
rotateAmount(0.0),
|
||||
counter(0),
|
||||
center(nullptr),
|
||||
currentFlip(SDL_FLIP_NONE) {
|
||||
ay(accely) {
|
||||
}
|
||||
|
||||
// Reinicia todas las variables
|
||||
void MovingSprite::clear() {
|
||||
x = 0.0f; // Posición en el eje X
|
||||
y = 0.0f; // Posición en el eje Y
|
||||
x = 0.0F; // Posición en el eje X
|
||||
y = 0.0F; // Posición en el eje Y
|
||||
|
||||
vx = 0.0f; // Velocidad en el eje X. Cantidad de pixeles a desplazarse
|
||||
vy = 0.0f; // Velocidad en el eje Y. Cantidad de pixeles a desplazarse
|
||||
vx = 0.0F; // Velocidad en el eje X. Cantidad de pixeles a desplazarse
|
||||
vy = 0.0F; // Velocidad en el eje Y. Cantidad de pixeles a desplazarse
|
||||
|
||||
ax = 0.0f; // Aceleración en el eje X. Variación de la velocidad
|
||||
ay = 0.0f; // Aceleración en el eje Y. Variación de la velocidad
|
||||
ax = 0.0F; // Aceleración en el eje X. Variación de la velocidad
|
||||
ay = 0.0F; // Aceleración en el eje Y. Variación de la velocidad
|
||||
|
||||
zoomW = 1.0f; // Zoom aplicado a la anchura
|
||||
zoomH = 1.0f; // Zoom aplicado a la altura
|
||||
zoomW = 1.0F; // Zoom aplicado a la anchura
|
||||
zoomH = 1.0F; // Zoom aplicado a la altura
|
||||
|
||||
angle = 0.0; // Angulo para dibujarlo
|
||||
rotateEnabled = false; // Indica si ha de rotar
|
||||
@@ -71,48 +62,48 @@ void MovingSprite::render() {
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
// cppcheck-suppress duplInheritedMember
|
||||
float MovingSprite::getPosX() {
|
||||
auto MovingSprite::getPosX() const -> float {
|
||||
return x;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
// cppcheck-suppress duplInheritedMember
|
||||
float MovingSprite::getPosY() {
|
||||
auto MovingSprite::getPosY() const -> float {
|
||||
return y;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
float MovingSprite::getVelX() {
|
||||
auto MovingSprite::getVelX() const -> float {
|
||||
return vx;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
float MovingSprite::getVelY() {
|
||||
auto MovingSprite::getVelY() const -> float {
|
||||
return vy;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
float MovingSprite::getAccelX() {
|
||||
auto MovingSprite::getAccelX() const -> float {
|
||||
return ax;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
float MovingSprite::getAccelY() {
|
||||
auto MovingSprite::getAccelY() const -> float {
|
||||
return ay;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
float MovingSprite::getZoomW() {
|
||||
auto MovingSprite::getZoomW() const -> float {
|
||||
return zoomW;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
float MovingSprite::getZoomH() {
|
||||
auto MovingSprite::getZoomH() const -> float {
|
||||
return zoomH;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
double MovingSprite::getAngle() {
|
||||
auto MovingSprite::getAngle() const -> double {
|
||||
return angle;
|
||||
}
|
||||
|
||||
@@ -180,23 +171,24 @@ void MovingSprite::decAngle(double value) {
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
bool MovingSprite::getRotate() {
|
||||
auto MovingSprite::getRotate() const -> bool {
|
||||
return rotateEnabled;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint16 MovingSprite::getRotateSpeed() {
|
||||
auto MovingSprite::getRotateSpeed() const -> Uint16 {
|
||||
return rotateSpeed;
|
||||
}
|
||||
|
||||
// Establece la rotacion
|
||||
void MovingSprite::rotate() {
|
||||
if (enabled)
|
||||
if (enabled) {
|
||||
if (rotateEnabled) {
|
||||
if (counter % rotateSpeed == 0) {
|
||||
incAngle(rotateAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
@@ -250,12 +242,12 @@ void MovingSprite::flip() {
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
SDL_FlipMode MovingSprite::getFlip() {
|
||||
auto MovingSprite::getFlip() -> SDL_FlipMode {
|
||||
return currentFlip;
|
||||
}
|
||||
|
||||
// Devuelve el rectangulo donde está el sprite
|
||||
SDL_Rect MovingSprite::getRect() {
|
||||
auto MovingSprite::getRect() -> SDL_Rect {
|
||||
const SDL_Rect rect = {(int)x, (int)y, w, h};
|
||||
return rect;
|
||||
}
|
||||
@@ -278,10 +270,10 @@ void MovingSprite::undoMoveY() {
|
||||
|
||||
// Pone a cero las velocidades de desplacamiento
|
||||
void MovingSprite::clearVel() {
|
||||
vx = vy = 0.0f;
|
||||
vx = vy = 0.0F;
|
||||
}
|
||||
|
||||
// Devuelve el incremento en el eje X en pixels
|
||||
int MovingSprite::getIncX() {
|
||||
auto MovingSprite::getIncX() const -> int {
|
||||
return (int)x - (int)xPrev;
|
||||
}
|
||||
Reference in New Issue
Block a user