layout de TITOL
This commit is contained in:
@@ -323,22 +323,19 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
}
|
||||
|
||||
// Calcular global progress (0.0 al inicio → 1.0 al final)
|
||||
float global_progress = 1.0f - (stage_manager_->get_timer_transicio() /
|
||||
Defaults::Game::INIT_HUD_DURATION);
|
||||
float global_progress = 1.0f - (stage_manager_->get_timer_transicio() / Defaults::Game::INIT_HUD_DURATION);
|
||||
global_progress = std::min(1.0f, global_progress);
|
||||
|
||||
// [NEW] Calcular progress independiente para cada nave
|
||||
float ship1_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END);
|
||||
|
||||
float ship2_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END);
|
||||
|
||||
// [MODIFICAT] Animar AMBAS naus con sus progress respectivos
|
||||
if (config_partida_.jugador1_actiu && ship1_progress < 1.0f) {
|
||||
@@ -501,26 +498,22 @@ void EscenaJoc::dibuixar() {
|
||||
float rect_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_RECT_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_RECT_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_RECT_RATIO_END);
|
||||
|
||||
float score_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SCORE_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SCORE_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SCORE_RATIO_END);
|
||||
|
||||
float ship1_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END);
|
||||
|
||||
float ship2_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END);
|
||||
|
||||
// Dibuixar elements animats
|
||||
if (rect_progress > 0.0f) {
|
||||
@@ -643,15 +636,15 @@ void EscenaJoc::tocado(uint8_t player_id) {
|
||||
Punt vel_nau_80 = {vel_nau.x * 0.8f, vel_nau.y * 0.8f};
|
||||
|
||||
debris_manager_.explotar(
|
||||
naus_[player_id].get_forma(), // Ship shape (3 lines)
|
||||
ship_pos, // Center position
|
||||
ship_angle, // Ship orientation
|
||||
1.0f, // Normal scale
|
||||
Defaults::Physics::Debris::VELOCITAT_BASE, // 80 px/s
|
||||
naus_[player_id].get_brightness(), // Heredar brightness
|
||||
vel_nau_80, // Heredar 80% velocitat
|
||||
0.0f, // Nave: trayectorias rectas (sin drotacio)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
naus_[player_id].get_forma(), // Ship shape (3 lines)
|
||||
ship_pos, // Center position
|
||||
ship_angle, // Ship orientation
|
||||
1.0f, // Normal scale
|
||||
Defaults::Physics::Debris::VELOCITAT_BASE, // 80 px/s
|
||||
naus_[player_id].get_brightness(), // Heredar brightness
|
||||
vel_nau_80, // Heredar 80% velocitat
|
||||
0.0f, // Nave: trayectorias rectas (sin drotacio)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
);
|
||||
|
||||
Audio::get()->playSound(Defaults::Sound::EXPLOSION, Audio::Group::GAME);
|
||||
@@ -863,7 +856,7 @@ std::string EscenaJoc::construir_marcador() const {
|
||||
// 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);
|
||||
: std::to_string(stage_num);
|
||||
|
||||
// Puntuació P2 (6 dígits) - mostrar zeros si inactiu
|
||||
std::string score_p2;
|
||||
@@ -946,15 +939,15 @@ void EscenaJoc::detectar_col·lisions_bales_enemics() {
|
||||
// 2. Crear explosió de fragments
|
||||
Punt vel_enemic = enemic.get_velocitat_vector();
|
||||
debris_manager_.explotar(
|
||||
enemic.get_forma(), // Forma vectorial del pentàgon
|
||||
pos_enemic, // Posició central
|
||||
0.0f, // Angle (enemic té rotació interna)
|
||||
1.0f, // Escala normal
|
||||
VELOCITAT_EXPLOSIO, // 50 px/s (explosió suau)
|
||||
enemic.get_brightness(), // Heredar brightness
|
||||
vel_enemic, // Heredar velocitat
|
||||
enemic.get_drotacio(), // Heredar velocitat angular (trayectorias curvas)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
enemic.get_forma(), // Forma vectorial del pentàgon
|
||||
pos_enemic, // Posició central
|
||||
0.0f, // Angle (enemic té rotació interna)
|
||||
1.0f, // Escala normal
|
||||
VELOCITAT_EXPLOSIO, // 50 px/s (explosió suau)
|
||||
enemic.get_brightness(), // Heredar brightness
|
||||
vel_enemic, // Heredar velocitat
|
||||
enemic.get_drotacio(), // Heredar velocitat angular (trayectorias curvas)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
);
|
||||
|
||||
// 3. Desactivar bala
|
||||
@@ -1063,8 +1056,8 @@ void EscenaJoc::dibuixar_missatge_stage(const std::string& missatge) {
|
||||
|
||||
// Auto-scale if text exceeds max width
|
||||
float escala = (text_width_at_base <= max_width)
|
||||
? escala_base
|
||||
: max_width / text_width_at_base;
|
||||
? escala_base
|
||||
: max_width / text_width_at_base;
|
||||
|
||||
// Recalculate dimensions with final scale (using FULL message for centering)
|
||||
float full_text_width = text_.get_text_width(missatge, escala, spacing);
|
||||
@@ -1099,8 +1092,7 @@ Punt EscenaJoc::obtenir_punt_spawn(uint8_t player_id) const {
|
||||
|
||||
return {
|
||||
zona.x + zona.w * x_ratio,
|
||||
zona.y + zona.h * Defaults::Game::SPAWN_Y_RATIO
|
||||
};
|
||||
zona.y + zona.h * Defaults::Game::SPAWN_Y_RATIO};
|
||||
}
|
||||
|
||||
void EscenaJoc::disparar_bala(uint8_t player_id) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "../constants.hpp"
|
||||
#include "../effects/debris_manager.hpp"
|
||||
@@ -23,8 +24,6 @@
|
||||
#include "core/system/game_config.hpp"
|
||||
#include "core/types.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
// Classe principal del joc (escena)
|
||||
class EscenaJoc {
|
||||
public:
|
||||
@@ -57,7 +56,7 @@ class EscenaJoc {
|
||||
bool game_over_; // Game over state flag
|
||||
float game_over_timer_; // Countdown timer for auto-return (seconds)
|
||||
// Punt punt_spawn_; // DEPRECATED: usar obtenir_punt_spawn(player_id)
|
||||
Punt punt_mort_; // Death position (for respawn, legacy)
|
||||
Punt punt_mort_; // Death position (for respawn, legacy)
|
||||
std::array<int, 2> puntuacio_per_jugador_; // [0]=P1, [1]=P2
|
||||
|
||||
// Text vectorial
|
||||
@@ -72,20 +71,20 @@ class EscenaJoc {
|
||||
|
||||
// Funcions privades
|
||||
void tocado(uint8_t player_id);
|
||||
void detectar_col·lisions_bales_enemics(); // Col·lisions bala-enemic
|
||||
void detectar_col·lisio_naus_enemics(); // Ship-enemy collision detection (plural)
|
||||
void dibuixar_marges() const; // Dibuixar vores de la zona de joc
|
||||
void dibuixar_marcador(); // Dibuixar marcador de puntuació
|
||||
void disparar_bala(uint8_t player_id); // Shoot bullet from player
|
||||
void detectar_col·lisions_bales_enemics(); // Col·lisions bala-enemic
|
||||
void detectar_col·lisio_naus_enemics(); // Ship-enemy collision detection (plural)
|
||||
void dibuixar_marges() const; // Dibuixar vores de la zona de joc
|
||||
void dibuixar_marcador(); // Dibuixar marcador de puntuació
|
||||
void disparar_bala(uint8_t player_id); // Shoot bullet from player
|
||||
Punt obtenir_punt_spawn(uint8_t player_id) const; // Get spawn position for player
|
||||
|
||||
// [NEW] Stage system helpers
|
||||
void dibuixar_missatge_stage(const std::string& missatge);
|
||||
|
||||
// [NEW] Funcions d'animació per INIT_HUD
|
||||
void dibuixar_marges_animat(float progress) const; // Rectangle amb creixement uniforme
|
||||
void dibuixar_marcador_animat(float progress); // Marcador que puja des de baix
|
||||
Punt calcular_posicio_nau_init_hud(float progress, uint8_t player_id) const; // Posició animada de la nau
|
||||
void dibuixar_marges_animat(float progress) const; // Rectangle amb creixement uniforme
|
||||
void dibuixar_marcador_animat(float progress); // Marcador que puja des de baix
|
||||
Punt calcular_posicio_nau_init_hud(float progress, uint8_t player_id) const; // Posició animada de la nau
|
||||
|
||||
// [NEW] Función helper del sistema de animación INIT_HUD
|
||||
float calcular_progress_rango(float global_progress, float ratio_init, float ratio_end) const;
|
||||
|
||||
@@ -220,10 +220,8 @@ void EscenaLogo::canviar_estat(EstatAnimacio nou_estat) {
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
std::shuffle(ordre_explosio_.begin(), ordre_explosio_.end(), g);
|
||||
}
|
||||
else if (nou_estat == EstatAnimacio::POST_EXPLOSION)
|
||||
{
|
||||
Audio::get()->playMusic("title.ogg");
|
||||
} else if (nou_estat == EstatAnimacio::POST_EXPLOSION) {
|
||||
Audio::get()->playMusic("title.ogg");
|
||||
}
|
||||
|
||||
std::cout << "[EscenaLogo] Canvi a estat: " << static_cast<int>(nou_estat)
|
||||
@@ -246,13 +244,13 @@ void EscenaLogo::actualitzar_explosions(float delta_time) {
|
||||
const auto& lletra = lletres_[index_actual];
|
||||
|
||||
debris_manager_->explotar(
|
||||
lletra.forma, // Forma a explotar
|
||||
lletra.posicio, // Posició
|
||||
0.0f, // Angle (sense rotació)
|
||||
ESCALA_FINAL, // Escala (lletres a escala final)
|
||||
VELOCITAT_EXPLOSIO, // Velocitat base
|
||||
1.0f, // Brightness màxim (per defecte)
|
||||
{0.0f, 0.0f} // Sense velocitat (per defecte)
|
||||
lletra.forma, // Forma a explotar
|
||||
lletra.posicio, // Posició
|
||||
0.0f, // Angle (sense rotació)
|
||||
ESCALA_FINAL, // Escala (lletres a escala final)
|
||||
VELOCITAT_EXPLOSIO, // Velocitat base
|
||||
1.0f, // Brightness màxim (per defecte)
|
||||
{0.0f, 0.0f} // Sense velocitat (per defecte)
|
||||
);
|
||||
|
||||
std::cout << "[EscenaLogo] Explota lletra " << lletra_explosio_index_ << "\n";
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "game/effects/debris_manager.hpp"
|
||||
#include "core/defaults.hpp"
|
||||
#include "core/graphics/shape.hpp"
|
||||
#include "core/input/input_types.hpp"
|
||||
#include "core/rendering/sdl_manager.hpp"
|
||||
#include "core/system/context_escenes.hpp"
|
||||
#include "core/types.hpp"
|
||||
#include "game/effects/debris_manager.hpp"
|
||||
|
||||
class EscenaLogo {
|
||||
public:
|
||||
explicit EscenaLogo(SDLManager& sdl, GestorEscenes::ContextEscenes& context);
|
||||
~EscenaLogo(); // Destructor per aturar sons
|
||||
~EscenaLogo(); // Destructor per aturar sons
|
||||
void executar(); // Bucle principal de l'escena
|
||||
|
||||
private:
|
||||
|
||||
@@ -140,10 +140,10 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
float ancho_sin_escalar = max_x - min_x;
|
||||
float altura_sin_escalar = max_y - min_y;
|
||||
|
||||
// Escalar ancho, altura i offset amb ESCALA_TITULO
|
||||
float ancho = ancho_sin_escalar * ESCALA_TITULO;
|
||||
float altura = altura_sin_escalar * ESCALA_TITULO;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * ESCALA_TITULO;
|
||||
// Escalar ancho, altura i offset amb LOGO_SCALE
|
||||
float ancho = ancho_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float altura = altura_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
|
||||
lletres_orni_.push_back({forma, {0.0f, 0.0f}, ancho, altura, offset_centre});
|
||||
|
||||
@@ -159,7 +159,7 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
|
||||
for (auto& lletra : lletres_orni_) {
|
||||
lletra.posicio.x = x_actual + lletra.offset_centre;
|
||||
lletra.posicio.y = Y_ORNI;
|
||||
lletra.posicio.y = Defaults::Game::HEIGHT * Defaults::Title::Layout::LOGO_POS;
|
||||
x_actual += lletra.ancho + ESPAI_ENTRE_LLETRES;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,9 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
// === Calcular posició Y dinàmica per "ATTACK!" ===
|
||||
// Totes les lletres ORNI tenen la mateixa altura, utilitzem la primera
|
||||
float altura_orni = lletres_orni_.empty() ? 50.0f : lletres_orni_[0].altura;
|
||||
y_attack_dinamica_ = Y_ORNI + altura_orni + SEPARACION_LINEAS;
|
||||
float y_orni = Defaults::Game::HEIGHT * Defaults::Title::Layout::LOGO_POS;
|
||||
float separacion_lineas = Defaults::Game::HEIGHT * Defaults::Title::Layout::LOGO_LINE_SPACING;
|
||||
y_attack_dinamica_ = y_orni + altura_orni + separacion_lineas;
|
||||
|
||||
std::cout << "[EscenaTitol] Altura ORNI: " << altura_orni
|
||||
<< " px, Y_ATTACK dinàmica: " << y_attack_dinamica_ << " px\n";
|
||||
@@ -212,10 +214,10 @@ void EscenaTitol::inicialitzar_titol() {
|
||||
float ancho_sin_escalar = max_x - min_x;
|
||||
float altura_sin_escalar = max_y - min_y;
|
||||
|
||||
// Escalar ancho, altura i offset amb ESCALA_TITULO
|
||||
float ancho = ancho_sin_escalar * ESCALA_TITULO;
|
||||
float altura = altura_sin_escalar * ESCALA_TITULO;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * ESCALA_TITULO;
|
||||
// Escalar ancho, altura i offset amb LOGO_SCALE
|
||||
float ancho = ancho_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float altura = altura_sin_escalar * Defaults::Title::Layout::LOGO_SCALE;
|
||||
float offset_centre = (forma->get_centre().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
|
||||
lletres_attack_.push_back({forma, {0.0f, 0.0f}, ancho, altura, offset_centre});
|
||||
|
||||
@@ -326,9 +328,9 @@ void EscenaTitol::actualitzar(float delta_time) {
|
||||
// Actualitzar naus (quan visibles)
|
||||
if (ship_animator_ &&
|
||||
(estat_actual_ == EstatTitol::STARFIELD_FADE_IN ||
|
||||
estat_actual_ == EstatTitol::STARFIELD ||
|
||||
estat_actual_ == EstatTitol::MAIN ||
|
||||
estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE)) {
|
||||
estat_actual_ == EstatTitol::STARFIELD ||
|
||||
estat_actual_ == EstatTitol::MAIN ||
|
||||
estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE)) {
|
||||
ship_animator_->actualitzar(delta_time);
|
||||
}
|
||||
|
||||
@@ -346,7 +348,7 @@ void EscenaTitol::actualitzar(float delta_time) {
|
||||
// Transició a STARFIELD quan el fade es completa
|
||||
if (temps_acumulat_ >= DURACIO_FADE_IN) {
|
||||
estat_actual_ = EstatTitol::STARFIELD;
|
||||
temps_acumulat_ = 0.0f; // Reset timer per al següent estat
|
||||
temps_acumulat_ = 0.0f; // Reset timer per al següent estat
|
||||
starfield_->set_brightness(BRIGHTNESS_STARFIELD); // Assegurar valor final
|
||||
}
|
||||
break;
|
||||
@@ -538,9 +540,9 @@ void EscenaTitol::dibuixar() {
|
||||
// Dibuixar naus (després starfield, abans logo)
|
||||
if (ship_animator_ &&
|
||||
(estat_actual_ == EstatTitol::STARFIELD_FADE_IN ||
|
||||
estat_actual_ == EstatTitol::STARFIELD ||
|
||||
estat_actual_ == EstatTitol::MAIN ||
|
||||
estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE)) {
|
||||
estat_actual_ == EstatTitol::STARFIELD ||
|
||||
estat_actual_ == EstatTitol::MAIN ||
|
||||
estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE)) {
|
||||
ship_animator_->dibuixar();
|
||||
}
|
||||
|
||||
@@ -580,7 +582,7 @@ void EscenaTitol::dibuixar() {
|
||||
lletres_orni_[i].forma,
|
||||
pos_shadow,
|
||||
0.0f,
|
||||
ESCALA_TITULO,
|
||||
Defaults::Title::Layout::LOGO_SCALE,
|
||||
true,
|
||||
1.0f, // progress = 1.0 (totalment visible)
|
||||
SHADOW_BRIGHTNESS // brightness = 0.4 (brillantor reduïda)
|
||||
@@ -598,7 +600,7 @@ void EscenaTitol::dibuixar() {
|
||||
lletres_attack_[i].forma,
|
||||
pos_shadow,
|
||||
0.0f,
|
||||
ESCALA_TITULO,
|
||||
Defaults::Title::Layout::LOGO_SCALE,
|
||||
true,
|
||||
1.0f, // progress = 1.0 (totalment visible)
|
||||
SHADOW_BRIGHTNESS);
|
||||
@@ -614,7 +616,7 @@ void EscenaTitol::dibuixar() {
|
||||
lletra.forma,
|
||||
lletra.posicio,
|
||||
0.0f,
|
||||
ESCALA_TITULO,
|
||||
Defaults::Title::Layout::LOGO_SCALE,
|
||||
true,
|
||||
1.0f // Brillantor completa
|
||||
);
|
||||
@@ -627,7 +629,7 @@ void EscenaTitol::dibuixar() {
|
||||
lletra.forma,
|
||||
lletra.posicio,
|
||||
0.0f,
|
||||
ESCALA_TITULO,
|
||||
Defaults::Title::Layout::LOGO_SCALE,
|
||||
true,
|
||||
1.0f // Brillantor completa
|
||||
);
|
||||
@@ -637,7 +639,7 @@ void EscenaTitol::dibuixar() {
|
||||
// En estat MAIN: sempre visible
|
||||
// En estat TRANSITION: parpellejant (blink amb sinusoide)
|
||||
|
||||
const float spacing = 2.0f; // Espai entre caràcters (usat també per copyright)
|
||||
const float spacing = Defaults::Title::Layout::TEXT_SPACING;
|
||||
|
||||
bool mostrar_text = true;
|
||||
if (estat_actual_ == EstatTitol::PLAYER_JOIN_PHASE) {
|
||||
@@ -648,34 +650,46 @@ void EscenaTitol::dibuixar() {
|
||||
|
||||
if (mostrar_text) {
|
||||
const std::string main_text = "PRESS START TO PLAY";
|
||||
const float escala_main = 1.0f;
|
||||
const float escala_main = Defaults::Title::Layout::PRESS_START_SCALE;
|
||||
|
||||
float text_width = text_.get_text_width(main_text, escala_main, spacing);
|
||||
|
||||
float x_center = (Defaults::Game::WIDTH - text_width) / 2.0f;
|
||||
float altura_attack = lletres_attack_.empty() ? 50.0f : lletres_attack_[0].altura;
|
||||
float y_center = y_attack_dinamica_ + altura_attack + 70.0f;
|
||||
float y_center = Defaults::Game::HEIGHT * Defaults::Title::Layout::PRESS_START_POS;
|
||||
|
||||
text_.render(main_text, Punt{x_center, y_center}, escala_main, spacing);
|
||||
}
|
||||
|
||||
// === Copyright a la part inferior (centrat horitzontalment) ===
|
||||
// Convert to uppercase since VectorText only supports A-Z
|
||||
std::string copyright = Project::COPYRIGHT;
|
||||
for (char& c : copyright) {
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
c = c - 32; // Convert to uppercase
|
||||
}
|
||||
// === Copyright a la part inferior (centrat horitzontalment, dues línies) ===
|
||||
const float escala_copy = Defaults::Title::Layout::COPYRIGHT_SCALE;
|
||||
const float copy_height = text_.get_text_height(escala_copy);
|
||||
const float line_spacing = Defaults::Game::HEIGHT * Defaults::Title::Layout::COPYRIGHT_LINE_SPACING;
|
||||
|
||||
// Línea 1: Original (© 1999 Visente i Sergi)
|
||||
std::string copyright_original = Project::COPYRIGHT_ORIGINAL;
|
||||
for (char& c : copyright_original) {
|
||||
if (c >= 'a' && c <= 'z') c = c - 32; // Uppercase
|
||||
}
|
||||
const float escala_copy = 0.6f;
|
||||
|
||||
float copy_width = text_.get_text_width(copyright, escala_copy, spacing);
|
||||
float copy_height = text_.get_text_height(escala_copy);
|
||||
// Línea 2: Port (© 2025 jaildesigner)
|
||||
std::string copyright_port = Project::COPYRIGHT_PORT;
|
||||
for (char& c : copyright_port) {
|
||||
if (c >= 'a' && c <= 'z') c = c - 32; // Uppercase
|
||||
}
|
||||
|
||||
float x_copy = (Defaults::Game::WIDTH - copy_width) / 2.0f;
|
||||
float y_copy = Defaults::Game::HEIGHT - copy_height - 20.0f; // 20px des del fons
|
||||
// Calcular posicions (anclatge des del top + separació)
|
||||
float y_line1 = Defaults::Game::HEIGHT * Defaults::Title::Layout::COPYRIGHT1_POS;
|
||||
float y_line2 = y_line1 + copy_height + line_spacing; // Línea 2 debajo de línea 1
|
||||
|
||||
text_.render(copyright, Punt{x_copy, y_copy}, escala_copy, spacing);
|
||||
// Renderitzar línea 1 (original)
|
||||
float width_line1 = text_.get_text_width(copyright_original, escala_copy, spacing);
|
||||
float x_line1 = (Defaults::Game::WIDTH - width_line1) / 2.0f;
|
||||
text_.render(copyright_original, Punt{x_line1, y_line1}, escala_copy, spacing);
|
||||
|
||||
// Renderitzar línea 2 (port)
|
||||
float width_line2 = text_.get_text_width(copyright_port, escala_copy, spacing);
|
||||
float x_line2 = (Defaults::Game::WIDTH - width_line2) / 2.0f;
|
||||
text_.render(copyright_port, Punt{x_line2, y_line2}, escala_copy, spacing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
|
||||
// Botones para INICIAR PARTIDA desde MAIN (solo START)
|
||||
static constexpr std::array<InputAction, 1> START_GAME_BUTTONS = {
|
||||
InputAction::START
|
||||
};
|
||||
InputAction::START};
|
||||
|
||||
class EscenaTitol {
|
||||
public:
|
||||
@@ -53,12 +52,12 @@ class EscenaTitol {
|
||||
|
||||
SDLManager& sdl_;
|
||||
GestorEscenes::ContextEscenes& context_;
|
||||
GameConfig::ConfigPartida config_partida_; // Configuració de jugadors actius
|
||||
GameConfig::ConfigPartida config_partida_; // Configuració de jugadors actius
|
||||
Graphics::VectorText text_; // Sistema de text vectorial
|
||||
std::unique_ptr<Graphics::Starfield> starfield_; // Camp d'estrelles de fons
|
||||
std::unique_ptr<Graphics::Starfield> starfield_; // Camp d'estrelles de fons
|
||||
std::unique_ptr<Title::ShipAnimator> ship_animator_; // Naus 3D flotants
|
||||
EstatTitol estat_actual_; // Estat actual de la màquina
|
||||
float temps_acumulat_; // Temps acumulat per l'estat INIT
|
||||
EstatTitol estat_actual_; // Estat actual de la màquina
|
||||
float temps_acumulat_; // Temps acumulat per l'estat INIT
|
||||
|
||||
// Lletres del títol "ORNI ATTACK!"
|
||||
std::vector<LetraLogo> lletres_orni_; // Lletres de "ORNI" (línia 1)
|
||||
@@ -80,10 +79,7 @@ class EscenaTitol {
|
||||
static constexpr float DURACIO_FADE_IN = 3.0f; // Duració del fade-in del starfield (1.5 segons)
|
||||
static constexpr float DURACIO_INIT = 4.0f; // Duració de l'estat INIT (2 segons)
|
||||
static constexpr float DURACIO_TRANSITION = 2.5f; // Duració de la transició (1.5 segons)
|
||||
static constexpr float ESCALA_TITULO = 0.6f; // Escala per les lletres del títol (50%)
|
||||
static constexpr float ESPAI_ENTRE_LLETRES = 10.0f; // Espai entre lletres
|
||||
static constexpr float Y_ORNI = 150.0f; // Posició Y de "ORNI"
|
||||
static constexpr float SEPARACION_LINEAS = 10.0f; // Separació entre "ORNI" i "ATTACK!" (0.0f = pegades)
|
||||
static constexpr float BLINK_FREQUENCY = 3.0f; // Freqüència de parpelleig (3 Hz)
|
||||
static constexpr float DURACIO_BLACK_SCREEN = 2.0f; // Duració pantalla negra (2 segons)
|
||||
static constexpr int MUSIC_FADE = 1500; // Duracio del fade de la musica del titol al començar a jugar
|
||||
|
||||
Reference in New Issue
Block a user