Files
orni_attack/source/game/entities/bala.hpp
Sergio Valor 70f2642e6d feat(linter): afegir checks llvm-include-order i misc-include-cleaner
- Check 11: llvm-include-order (0 errors - codi ja compleix)
- Check 12: misc-include-cleaner (detectar includes no usats i faltants)
  - Configurar IgnoreHeaders per SDL3 (genera falsos positius)
  - Fix: afegir <cstdint> a nau.hpp, enemic.hpp, bala.hpp
  - Fix: afegir <cmath> a nau.hpp, enemic.hpp (std::cos/sin)

Include order validat segons LLVM coding standards.
Headers més nets i compilació més ràpida.
2025-12-18 22:35:46 +01:00

49 lines
1.4 KiB
C++

// bala.hpp - Classe per a projectils de la nau
// © 1999 Visente i Sergi (versió Pascal)
// © 2025 Port a C++20 amb SDL3
#pragma once
#include <SDL3/SDL.h>
#include <cstdint>
#include <memory>
#include "core/graphics/shape.hpp"
#include "core/types.hpp"
class Bala {
public:
Bala()
: renderer_(nullptr) {}
Bala(SDL_Renderer* renderer);
void inicialitzar();
void disparar(const Punt& posicio, float angle, uint8_t owner_id);
void actualitzar(float delta_time);
void dibuixar() const;
// Getters (API pública sense canvis)
[[nodiscard]] bool esta_activa() const { return esta_; }
[[nodiscard]] const Punt& get_centre() const { return centre_; }
[[nodiscard]] uint8_t get_owner_id() const { return owner_id_; }
[[nodiscard]] float get_grace_timer() const { return grace_timer_; }
void desactivar() { esta_ = false; }
private:
SDL_Renderer* renderer_;
// [NUEVO] Forma vectorial (compartida entre totes les bales)
std::shared_ptr<Graphics::Shape> forma_;
// [NUEVO] Estat de la instància (separat de la geometria)
Punt centre_;
float angle_;
float velocitat_;
bool esta_;
uint8_t owner_id_; // 0=P1, 1=P2
float grace_timer_; // Grace period timer (0.0 = vulnerable)
float brightness_; // Factor de brillantor (0.0-1.0)
void mou(float delta_time);
};