nous sons
This commit is contained in:
@@ -51,13 +51,14 @@ void DebrisManager::explotar(const std::shared_ptr<Graphics::Shape>& shape,
|
||||
float brightness,
|
||||
const Punt& velocitat_objecte,
|
||||
float velocitat_angular,
|
||||
float factor_herencia_visual) {
|
||||
float factor_herencia_visual,
|
||||
const std::string& sound) {
|
||||
if (!shape || !shape->es_valida()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reproducir sonido de explosión
|
||||
Audio::get()->playSound(Defaults::Sound::EXPLOSION, Audio::Group::GAME);
|
||||
Audio::get()->playSound(sound, Audio::Group::GAME);
|
||||
|
||||
// Obtenir centre de la forma per a transformacions
|
||||
const Punt& shape_centre = shape->get_centre();
|
||||
|
||||
@@ -37,7 +37,8 @@ class DebrisManager {
|
||||
float brightness = 1.0f,
|
||||
const Punt& velocitat_objecte = {0.0f, 0.0f},
|
||||
float velocitat_angular = 0.0f,
|
||||
float factor_herencia_visual = 0.0f);
|
||||
float factor_herencia_visual = 0.0f,
|
||||
const std::string& sound = Defaults::Sound::EXPLOSION);
|
||||
|
||||
// Actualitzar tots els fragments actius
|
||||
void actualitzar(float delta_time);
|
||||
|
||||
@@ -61,16 +61,11 @@ void GestorPuntuacioFlotant::dibuixar() {
|
||||
if (!pf.actiu)
|
||||
continue;
|
||||
|
||||
// 1. Calcular dimensions del text per centrar-lo
|
||||
// Renderitzar centrat amb brightness (fade)
|
||||
constexpr float escala = Defaults::FloatingScore::SCALE;
|
||||
constexpr float spacing = Defaults::FloatingScore::SPACING;
|
||||
float text_width = text_.get_text_width(pf.text, escala, spacing);
|
||||
|
||||
// 2. Centrar text sobre la posició
|
||||
Punt render_pos = {pf.posicio.x - text_width / 2.0f, pf.posicio.y};
|
||||
|
||||
// 3. Renderitzar amb brightness (fade)
|
||||
text_.render(pf.text, render_pos, escala, spacing, pf.brightness);
|
||||
text_.render_centered(pf.text, pf.posicio, escala, spacing, pf.brightness);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user