Pasaeta de linters
This commit is contained in:
22
source/hit.h
22
source/hit.h
@@ -11,10 +11,10 @@
|
||||
struct Hit {
|
||||
private:
|
||||
// Indica si el Hit está activo o no
|
||||
bool enabled{false};
|
||||
bool enabled_{false};
|
||||
|
||||
// Sprite asociado al Hit, gestionado con un puntero único
|
||||
std::unique_ptr<Sprite> sprite;
|
||||
std::unique_ptr<Sprite> sprite_;
|
||||
|
||||
public:
|
||||
// Elimina el constructor por defecto para obligar a pasar una textura
|
||||
@@ -23,22 +23,22 @@ struct Hit {
|
||||
// Constructor que obliga a pasar una textura compartida para crear el Sprite
|
||||
// Esto evita que se pueda crear un Hit sin recursos gráficos válidos
|
||||
explicit Hit(std::shared_ptr<Texture> texture)
|
||||
: sprite(std::make_unique<Sprite>(texture)) {}
|
||||
: sprite_(std::make_unique<Sprite>(texture)) {}
|
||||
|
||||
// Establece la posición del Sprite en el espacio
|
||||
void setPos(SDL_FPoint position) {
|
||||
SDL_FPoint centered_position = {position.x - (sprite->getWidth() / 2), position.y - (sprite->getHeight() / 2)};
|
||||
sprite->setPosition(centered_position);
|
||||
SDL_FPoint centered_position = {position.x - (sprite_->getWidth() / 2), position.y - (sprite_->getHeight() / 2)};
|
||||
sprite_->setPosition(centered_position);
|
||||
}
|
||||
|
||||
// Activa o desactiva el Hit
|
||||
void enable(bool value) {
|
||||
enabled = value;
|
||||
enabled_ = value;
|
||||
}
|
||||
|
||||
// Consulta si el Hit está activo
|
||||
bool isEnabled() const {
|
||||
return enabled;
|
||||
[[nodiscard]] auto isEnabled() const -> bool {
|
||||
return enabled_;
|
||||
}
|
||||
|
||||
// Crea un "Hit" en la posición especificada
|
||||
@@ -49,13 +49,13 @@ struct Hit {
|
||||
|
||||
// Dibuja el hit
|
||||
void render() {
|
||||
if (enabled) {
|
||||
sprite->render();
|
||||
if (enabled_) {
|
||||
sprite_->render();
|
||||
}
|
||||
}
|
||||
|
||||
// Deshabilita el hit
|
||||
void disable() {
|
||||
enabled = false;
|
||||
enabled_ = false;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user