revisat el marcador
modificada la shape 03
This commit is contained in:
@@ -7,5 +7,5 @@ scale: 1.0
|
|||||||
center: 10, 20
|
center: 10, 20
|
||||||
|
|
||||||
# Trazo continuo (barra superior + lateral derecho + barra media + lateral derecho + barra inferior)
|
# Trazo continuo (barra superior + lateral derecho + barra media + lateral derecho + barra inferior)
|
||||||
polyline: 2,10 18,10 18,20 14,20
|
polyline: 2,10 18,10 18,20 8,20
|
||||||
polyline: 14,20 18,20 18,30 2,30
|
polyline: 8,20 18,20 18,30 2,30
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ constexpr SDL_FRect SCOREBOARD = {
|
|||||||
static_cast<float>(Game::WIDTH), // w = 640.0
|
static_cast<float>(Game::WIDTH), // w = 640.0
|
||||||
SCOREBOARD_BOTTOM_H // h = 48.0
|
SCOREBOARD_BOTTOM_H // h = 48.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Padding horizontal del marcador (per alinear zones esquerra/dreta amb PLAYAREA)
|
||||||
|
constexpr float SCOREBOARD_PADDING_H = 0.0f;//Game::WIDTH * 0.015f;
|
||||||
} // namespace Zones
|
} // namespace Zones
|
||||||
|
|
||||||
// Objetos del juego
|
// Objetos del juego
|
||||||
|
|||||||
@@ -607,17 +607,8 @@ void EscenaJoc::dibuixar_marges() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EscenaJoc::dibuixar_marcador() {
|
void EscenaJoc::dibuixar_marcador() {
|
||||||
// [MODIFIED] Display current stage number from stage manager
|
// Construir text del marcador
|
||||||
uint8_t stage_num = stage_manager_->get_stage_actual();
|
std::string text = construir_marcador();
|
||||||
std::string stage_str = (stage_num < 10) ? "0" + std::to_string(stage_num)
|
|
||||||
: std::to_string(stage_num);
|
|
||||||
|
|
||||||
// Format score with padding to 5 digits (e.g., 150 → "00150")
|
|
||||||
std::string score_str = std::to_string(puntuacio_total_);
|
|
||||||
score_str = std::string(5 - std::min(5, static_cast<int>(score_str.length())), '0') + score_str;
|
|
||||||
|
|
||||||
std::string text = "SCORE: " + score_str + " LIVES: " + std::to_string(num_vides_) +
|
|
||||||
" LEVEL: " + stage_str;
|
|
||||||
|
|
||||||
// Paràmetres de renderització
|
// Paràmetres de renderització
|
||||||
const float escala = 0.85f;
|
const float escala = 0.85f;
|
||||||
@@ -703,21 +694,13 @@ void EscenaJoc::dibuixar_marcador_animat(float progress) {
|
|||||||
// Calcular progrés amb easing
|
// Calcular progrés amb easing
|
||||||
float eased_progress = Easing::ease_out_quad(progress);
|
float eased_progress = Easing::ease_out_quad(progress);
|
||||||
|
|
||||||
// Posició final del marcador (normal)
|
// Construir text
|
||||||
|
std::string text = construir_marcador();
|
||||||
|
|
||||||
|
// Paràmetres
|
||||||
const float escala = 0.85f;
|
const float escala = 0.85f;
|
||||||
const float spacing = 0.0f;
|
const float spacing = 0.0f;
|
||||||
|
|
||||||
// Formatar text igual que en dibuixar_marcador() normal
|
|
||||||
uint8_t stage_num = stage_manager_->get_stage_actual();
|
|
||||||
std::string stage_str = (stage_num < 10) ? "0" + std::to_string(stage_num)
|
|
||||||
: std::to_string(stage_num);
|
|
||||||
|
|
||||||
std::string score_str = std::to_string(puntuacio_total_);
|
|
||||||
score_str = std::string(5 - std::min(5, static_cast<int>(score_str.length())), '0') + score_str;
|
|
||||||
|
|
||||||
std::string text = "SCORE: " + score_str + " LIVES: " + std::to_string(num_vides_) +
|
|
||||||
" LEVEL: " + stage_str;
|
|
||||||
|
|
||||||
// Calcular dimensions
|
// Calcular dimensions
|
||||||
float text_width = text_.get_text_width(text, escala, spacing);
|
float text_width = text_.get_text_width(text, escala, spacing);
|
||||||
float text_height = text_.get_text_height(escala);
|
float text_height = text_.get_text_height(escala);
|
||||||
@@ -763,6 +746,31 @@ Punt EscenaJoc::calcular_posicio_nau_init_hud(float progress) const {
|
|||||||
return {x_final, y_animada};
|
return {x_final, y_animada};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string EscenaJoc::construir_marcador() const {
|
||||||
|
// Puntuació P1 (5 dígits)
|
||||||
|
std::string score_p1 = std::to_string(puntuacio_total_);
|
||||||
|
score_p1 = std::string(6 - std::min(6, static_cast<int>(score_p1.length())), '0') + score_p1;
|
||||||
|
|
||||||
|
// Vides P1 (2 dígits)
|
||||||
|
std::string vides_p1 = (num_vides_ < 10) ? "0" + std::to_string(num_vides_)
|
||||||
|
: std::to_string(num_vides_);
|
||||||
|
|
||||||
|
// Nivell (2 dígits)
|
||||||
|
uint8_t stage_num = stage_manager_->get_stage_actual();
|
||||||
|
std::string stage_str = (stage_num < 10) ? "0" + std::to_string(stage_num)
|
||||||
|
: std::to_string(stage_num);
|
||||||
|
|
||||||
|
// Puntuació P2 (sempre 00000 per ara)
|
||||||
|
std::string score_p2 = "000000";
|
||||||
|
|
||||||
|
// Vides P2 (sempre 03 per ara)
|
||||||
|
std::string vides_p2 = "03";
|
||||||
|
|
||||||
|
// Format: "12345 03 LEVEL 01 00000 03"
|
||||||
|
// Nota: dos espais entre seccions
|
||||||
|
return score_p1 + " " + vides_p1 + " LEVEL " + stage_str + " " + score_p2 + " " + vides_p2;
|
||||||
|
}
|
||||||
|
|
||||||
void EscenaJoc::detectar_col·lisions_bales_enemics() {
|
void EscenaJoc::detectar_col·lisions_bales_enemics() {
|
||||||
// Constants amplificades per hitbox més generós (115%)
|
// Constants amplificades per hitbox més generós (115%)
|
||||||
constexpr float RADI_BALA = Defaults::Entities::BULLET_RADIUS;
|
constexpr float RADI_BALA = Defaults::Entities::BULLET_RADIUS;
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ class EscenaJoc {
|
|||||||
void dibuixar_marges_animat(float progress) const; // Rectangle amb creixement uniforme
|
void dibuixar_marges_animat(float progress) const; // Rectangle amb creixement uniforme
|
||||||
void dibuixar_marcador_animat(float progress); // Marcador que puja des de baix
|
void dibuixar_marcador_animat(float progress); // Marcador que puja des de baix
|
||||||
Punt calcular_posicio_nau_init_hud(float progress) const; // Posició animada de la nau
|
Punt calcular_posicio_nau_init_hud(float progress) const; // Posició animada de la nau
|
||||||
|
|
||||||
|
// [NEW] Funció helper del marcador
|
||||||
|
std::string construir_marcador() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ESCENA_JOC_HPP
|
#endif // ESCENA_JOC_HPP
|
||||||
|
|||||||
Reference in New Issue
Block a user