layout de TITOL

This commit is contained in:
2025-12-17 11:32:37 +01:00
parent 886ec8ab1d
commit 3b432e6580
45 changed files with 880 additions and 745 deletions

View File

@@ -17,8 +17,8 @@ ShipAnimator::ShipAnimator(SDL_Renderer* renderer)
void ShipAnimator::inicialitzar() {
// Carregar formes de naus amb perspectiva pre-calculada
auto forma_p1 = Graphics::ShapeLoader::load("ship_p1.shp"); // Perspectiva esquerra
auto forma_p2 = Graphics::ShapeLoader::load("ship2_p2.shp"); // Perspectiva dreta
auto forma_p1 = Graphics::ShapeLoader::load("ship_p1.shp"); // Perspectiva esquerra
auto forma_p2 = Graphics::ShapeLoader::load("ship2_p2.shp"); // Perspectiva dreta
// Configurar nau P1
naus_[0].jugador_id = 1;
@@ -59,11 +59,11 @@ void ShipAnimator::dibuixar() const {
renderer_,
nau.forma,
nau.posicio_actual,
0.0f, // angle (rotació 2D no utilitzada)
0.0f, // angle (rotació 2D no utilitzada)
nau.escala_actual,
true, // dibuixar
1.0f, // progress (sempre visible)
1.0f // brightness (brillantor màxima)
true, // dibuixar
1.0f, // progress (sempre visible)
1.0f // brightness (brillantor màxima)
);
}
}
@@ -227,7 +227,7 @@ void ShipAnimator::configurar_nau_p1(NauTitol& nau) {
nau.temps_estat = 0.0f;
// Posicions (clock 8, bottom-left)
nau.posicio_objectiu = {P1_TARGET_X, P1_TARGET_Y};
nau.posicio_objectiu = {P1_TARGET_X(), P1_TARGET_Y()};
// Calcular posició inicial (fora de pantalla)
nau.posicio_inicial = calcular_posicio_fora_pantalla(CLOCK_8_ANGLE);
@@ -262,7 +262,7 @@ void ShipAnimator::configurar_nau_p2(NauTitol& nau) {
nau.temps_estat = 0.0f;
// Posicions (clock 4, bottom-right)
nau.posicio_objectiu = {P2_TARGET_X, P2_TARGET_Y};
nau.posicio_objectiu = {P2_TARGET_X(), P2_TARGET_Y()};
// Calcular posició inicial (fora de pantalla)
nau.posicio_inicial = calcular_posicio_fora_pantalla(CLOCK_4_ANGLE);
@@ -293,7 +293,8 @@ Punt ShipAnimator::calcular_posicio_fora_pantalla(float angle_rellotge) const {
using namespace Defaults::Title::Ships;
// Convertir angle del rellotge a radians (per exemple: 240° per clock 8)
// Calcular posició en direcció radial des del centre, però més lluny (+ ENTRY_OFFSET)
// Calcular posició en direcció radial des del centre, però més lluny
// ENTRY_OFFSET es calcula automàticament: (SHIP_MAX_RADIUS * ENTRY_SCALE_START) + ENTRY_OFFSET_MARGIN
float extended_radius = CLOCK_RADIUS + ENTRY_OFFSET;
float x = Defaults::Game::WIDTH / 2.0f + extended_radius * std::cos(angle_rellotge);