pasaeta loca de clang-format (despres m'arrepentiré pero bueno)
This commit is contained in:
@@ -1,70 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h> // Para Uint8
|
||||
#include <memory> // Para unique_ptr
|
||||
#include <SDL3/SDL.h> // Para Uint8
|
||||
|
||||
#include "animated_sprite.h" // Para AnimatedSprite
|
||||
#include "utils.h" // Para Circle
|
||||
#include <memory> // Para unique_ptr
|
||||
|
||||
#include "animated_sprite.h" // Para AnimatedSprite
|
||||
#include "utils.h" // Para Circle
|
||||
|
||||
// Tipos de balas
|
||||
enum class BulletType : Uint8
|
||||
{
|
||||
UP,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
NONE
|
||||
enum class BulletType : Uint8 {
|
||||
UP,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
NONE
|
||||
};
|
||||
|
||||
// Resultado del movimiento de la bala
|
||||
enum class BulletMoveStatus : Uint8
|
||||
{
|
||||
OK = 0,
|
||||
OUT = 1
|
||||
enum class BulletMoveStatus : Uint8 {
|
||||
OK = 0,
|
||||
OUT = 1
|
||||
};
|
||||
|
||||
// Clase Bullet
|
||||
class Bullet
|
||||
{
|
||||
public:
|
||||
// Constantes
|
||||
static constexpr float WIDTH = 12.0f;
|
||||
static constexpr float HEIGHT = 12.0f;
|
||||
class Bullet {
|
||||
public:
|
||||
// Constantes
|
||||
static constexpr float WIDTH = 12.0f;
|
||||
static constexpr float HEIGHT = 12.0f;
|
||||
|
||||
// Constructor y Destructor
|
||||
Bullet(float x, float y, BulletType bullet_type, bool powered, int owner);
|
||||
~Bullet() = default;
|
||||
// Constructor y Destructor
|
||||
Bullet(float x, float y, BulletType bullet_type, bool powered, int owner);
|
||||
~Bullet() = default;
|
||||
|
||||
// Métodos principales
|
||||
void render(); // Dibuja la bala en pantalla
|
||||
BulletMoveStatus update(); // Actualiza el estado del objeto
|
||||
// Métodos principales
|
||||
void render(); // Dibuja la bala en pantalla
|
||||
BulletMoveStatus update(); // Actualiza el estado del objeto
|
||||
|
||||
// Estado de la bala
|
||||
bool isEnabled() const; // Comprueba si está activa
|
||||
void disable(); // Desactiva la bala
|
||||
// Estado de la bala
|
||||
bool isEnabled() const; // Comprueba si está activa
|
||||
void disable(); // Desactiva la bala
|
||||
|
||||
// Getters
|
||||
int getOwner() const; // Devuelve el identificador del dueño
|
||||
Circle &getCollider(); // Devuelve el círculo de colisión
|
||||
// Getters
|
||||
int getOwner() const; // Devuelve el identificador del dueño
|
||||
Circle &getCollider(); // Devuelve el círculo de colisión
|
||||
|
||||
private:
|
||||
// Constantes
|
||||
static constexpr float VEL_Y_ = -3.0f;
|
||||
static constexpr float VEL_X_LEFT_ = -2.0f;
|
||||
static constexpr float VEL_X_RIGHT_ = 2.0f;
|
||||
private:
|
||||
// Constantes
|
||||
static constexpr float VEL_Y_ = -3.0f;
|
||||
static constexpr float VEL_X_LEFT_ = -2.0f;
|
||||
static constexpr float VEL_X_RIGHT_ = 2.0f;
|
||||
|
||||
// Propiedades
|
||||
std::unique_ptr<AnimatedSprite> sprite_; // Sprite con los gráficos
|
||||
// Propiedades
|
||||
std::unique_ptr<AnimatedSprite> sprite_; // Sprite con los gráficos
|
||||
|
||||
float pos_x_; // Posición en el eje X
|
||||
float pos_y_; // Posición en el eje Y
|
||||
float vel_x_; // Velocidad en el eje X
|
||||
float pos_x_; // Posición en el eje X
|
||||
float pos_y_; // Posición en el eje Y
|
||||
float vel_x_; // Velocidad en el eje X
|
||||
|
||||
BulletType bullet_type_; // Tipo de bala
|
||||
int owner_; // Identificador del dueño
|
||||
Circle collider_; // Círculo de colisión
|
||||
BulletType bullet_type_; // Tipo de bala
|
||||
int owner_; // Identificador del dueño
|
||||
Circle collider_; // Círculo de colisión
|
||||
|
||||
// Métodos internos
|
||||
void shiftColliders(); // Ajusta el círculo de colisión
|
||||
void shiftSprite(); // Ajusta el sprite
|
||||
BulletMoveStatus move(); // Mueve la bala y devuelve su estado
|
||||
// Métodos internos
|
||||
void shiftColliders(); // Ajusta el círculo de colisión
|
||||
void shiftSprite(); // Ajusta el sprite
|
||||
BulletMoveStatus move(); // Mueve la bala y devuelve su estado
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user