forked from jaildesigner-jailgames/jaildoctors_dilemma
Commit to continue on other pc
This commit is contained in:
137
source/movingsprite.h
Normal file
137
source/movingsprite.h
Normal file
@@ -0,0 +1,137 @@
|
||||
#pragma once
|
||||
#include "ifdefs.h"
|
||||
#include "sprite.h"
|
||||
|
||||
#ifndef MOVINGSPRITE_H
|
||||
#define MOVINGSPRITE_H
|
||||
|
||||
// Clase MovingSprite. Añade posicion y velocidad en punto flotante
|
||||
class MovingSprite : public Sprite
|
||||
{
|
||||
protected:
|
||||
float mPosX; // Posición en el eje X
|
||||
float mPosY; // Posición en el eje Y
|
||||
|
||||
float mVelX; // Velocidad en el eje X. Cantidad de pixeles a desplazarse
|
||||
float mVelY; // Velocidad en el eje Y. Cantidad de pixeles a desplazarse
|
||||
|
||||
float mAccelX; // Aceleración en el eje X. Variación de la velocidad
|
||||
float mAccelY; // Aceleración en el eje Y. Variación de la velocidad
|
||||
|
||||
float mZoomW; // Zoom aplicado a la anchura
|
||||
float mZoomH; // Zoom aplicado a la altura
|
||||
|
||||
double mAngle; // Angulo para dibujarlo
|
||||
bool mRotate; // Indica si ha de rotar
|
||||
Uint16 mRotateSpeed; // Velocidad de giro
|
||||
double mRotateAmount; // Cantidad de grados a girar en cada iteración
|
||||
Uint16 mCounter; // Contador interno
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
MovingSprite();
|
||||
|
||||
// Destructor
|
||||
~MovingSprite();
|
||||
|
||||
// Iniciador
|
||||
void init(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, LTexture *texture, SDL_Renderer *renderer);
|
||||
|
||||
// Mueve el sprite
|
||||
void move();
|
||||
|
||||
// Rota el sprite
|
||||
void rotate();
|
||||
|
||||
// Actualiza las variables internas del objeto
|
||||
void update();
|
||||
|
||||
// Reinicia todas las variables
|
||||
void clear();
|
||||
|
||||
// Muestra el sprite por pantalla
|
||||
void render();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getPosX();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getPosY();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getVelX();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getVelY();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getAccelX();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getAccelY();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getZoomW();
|
||||
|
||||
// Obten el valor de la variable
|
||||
float getZoomH();
|
||||
|
||||
// Obten el valor de la variable
|
||||
double getAngle();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
bool getRotate();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint16 getRotateSpeed();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setPosX(float x);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setPosY(float y);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setVelX(float x);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setVelY(float y);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setAccelX(float x);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setAccelY(float y);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setZoomW(float w);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setZoomH(float h);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setAngle(double a);
|
||||
|
||||
// Incrementa el valor de la variable
|
||||
void incAngle(double inc);
|
||||
|
||||
// Decrementa el valor de la variable
|
||||
void decAngle(double dec);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setRotate(bool value);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setRotateSpeed(Uint16 value);
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setRotateAmount(double value);
|
||||
|
||||
// Quita el efecto de rotación y deja el sprite en su angulo inicial.
|
||||
void disableRotate();
|
||||
|
||||
// Cambia el sentido de la rotación
|
||||
void switchRotate();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user