layout de TITOL
This commit is contained in:
@@ -18,9 +18,9 @@ struct Debris {
|
||||
float acceleracio; // Acceleració negativa (fricció) en px/s²
|
||||
|
||||
// Rotació
|
||||
float angle_rotacio; // Angle de rotació acumulat (radians)
|
||||
float velocitat_rot; // Velocitat de rotació de TRAYECTORIA (rad/s)
|
||||
float velocitat_rot_visual; // Velocitat de rotació VISUAL del segment (rad/s)
|
||||
float angle_rotacio; // Angle de rotació acumulat (radians)
|
||||
float velocitat_rot; // Velocitat de rotació de TRAYECTORIA (rad/s)
|
||||
float velocitat_rot_visual; // Velocitat de rotació VISUAL del segment (rad/s)
|
||||
|
||||
// Estat de vida
|
||||
float temps_vida; // Temps transcorregut (segons)
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
namespace Effects {
|
||||
|
||||
GestorPuntuacioFlotant::GestorPuntuacioFlotant(SDL_Renderer* renderer)
|
||||
: renderer_(renderer), text_(renderer) {
|
||||
: renderer_(renderer),
|
||||
text_(renderer) {
|
||||
// Inicialitzar tots els slots com inactius
|
||||
for (auto& pf : pool_) {
|
||||
pf.actiu = false;
|
||||
@@ -25,7 +26,7 @@ void GestorPuntuacioFlotant::crear(int punts, const Punt& posicio) {
|
||||
pf->text = std::to_string(punts);
|
||||
pf->posicio = posicio;
|
||||
pf->velocitat = {Defaults::FloatingScore::VELOCITY_X,
|
||||
Defaults::FloatingScore::VELOCITY_Y};
|
||||
Defaults::FloatingScore::VELOCITY_Y};
|
||||
pf->temps_vida = 0.0f;
|
||||
pf->temps_max = Defaults::FloatingScore::LIFETIME;
|
||||
pf->brightness = 1.0f;
|
||||
|
||||
@@ -17,38 +17,38 @@ namespace Effects {
|
||||
// Gestor de números de puntuació flotants
|
||||
// Manté un pool de PuntuacioFlotant i gestiona el seu cicle de vida
|
||||
class GestorPuntuacioFlotant {
|
||||
public:
|
||||
explicit GestorPuntuacioFlotant(SDL_Renderer* renderer);
|
||||
public:
|
||||
explicit GestorPuntuacioFlotant(SDL_Renderer* renderer);
|
||||
|
||||
// Crear número flotant
|
||||
// - punts: valor numèric (100, 150, 200)
|
||||
// - posicio: on apareix (normalment centre d'enemic destruït)
|
||||
void crear(int punts, const Punt& posicio);
|
||||
// Crear número flotant
|
||||
// - punts: valor numèric (100, 150, 200)
|
||||
// - posicio: on apareix (normalment centre d'enemic destruït)
|
||||
void crear(int punts, const Punt& posicio);
|
||||
|
||||
// Actualitzar tots els números actius
|
||||
void actualitzar(float delta_time);
|
||||
// Actualitzar tots els números actius
|
||||
void actualitzar(float delta_time);
|
||||
|
||||
// Dibuixar tots els números actius
|
||||
void dibuixar();
|
||||
// Dibuixar tots els números actius
|
||||
void dibuixar();
|
||||
|
||||
// Reiniciar tots (neteja)
|
||||
void reiniciar();
|
||||
// Reiniciar tots (neteja)
|
||||
void reiniciar();
|
||||
|
||||
// Obtenir número actius (debug)
|
||||
int get_num_actius() const;
|
||||
// Obtenir número actius (debug)
|
||||
int get_num_actius() const;
|
||||
|
||||
private:
|
||||
SDL_Renderer* renderer_;
|
||||
Graphics::VectorText text_; // Sistema de text vectorial
|
||||
private:
|
||||
SDL_Renderer* renderer_;
|
||||
Graphics::VectorText text_; // Sistema de text vectorial
|
||||
|
||||
// Pool de números flotants (màxim concurrent)
|
||||
// Màxim 15 enemics simultanis = màxim 15 números
|
||||
static constexpr int MAX_PUNTUACIONS =
|
||||
Defaults::FloatingScore::MAX_CONCURRENT;
|
||||
std::array<PuntuacioFlotant, MAX_PUNTUACIONS> pool_;
|
||||
// Pool de números flotants (màxim concurrent)
|
||||
// Màxim 15 enemics simultanis = màxim 15 números
|
||||
static constexpr int MAX_PUNTUACIONS =
|
||||
Defaults::FloatingScore::MAX_CONCURRENT;
|
||||
std::array<PuntuacioFlotant, MAX_PUNTUACIONS> pool_;
|
||||
|
||||
// Trobar primer slot inactiu
|
||||
PuntuacioFlotant* trobar_slot_lliure();
|
||||
// Trobar primer slot inactiu
|
||||
PuntuacioFlotant* trobar_slot_lliure();
|
||||
};
|
||||
|
||||
} // namespace Effects
|
||||
|
||||
@@ -12,22 +12,22 @@ namespace Effects {
|
||||
// PuntuacioFlotant: text animat que mostra punts guanyats
|
||||
// S'activa quan es destrueix un enemic i s'esvaeix després d'un temps
|
||||
struct PuntuacioFlotant {
|
||||
// Text a mostrar (e.g., "100", "150", "200")
|
||||
std::string text;
|
||||
// Text a mostrar (e.g., "100", "150", "200")
|
||||
std::string text;
|
||||
|
||||
// Posició actual (coordenades mundials)
|
||||
Punt posicio;
|
||||
// Posició actual (coordenades mundials)
|
||||
Punt posicio;
|
||||
|
||||
// Animació de moviment
|
||||
Punt velocitat; // px/s (normalment cap amunt: {0.0f, -30.0f})
|
||||
// Animació de moviment
|
||||
Punt velocitat; // px/s (normalment cap amunt: {0.0f, -30.0f})
|
||||
|
||||
// Animació de fade
|
||||
float temps_vida; // Temps transcorregut (segons)
|
||||
float temps_max; // Temps de vida màxim (segons)
|
||||
float brightness; // Brillantor calculada (0.0-1.0)
|
||||
// Animació de fade
|
||||
float temps_vida; // Temps transcorregut (segons)
|
||||
float temps_max; // Temps de vida màxim (segons)
|
||||
float brightness; // Brillantor calculada (0.0-1.0)
|
||||
|
||||
// Estat
|
||||
bool actiu;
|
||||
// Estat
|
||||
bool actiu;
|
||||
};
|
||||
|
||||
} // namespace Effects
|
||||
|
||||
Reference in New Issue
Block a user