Lint: rename de helpers file-static y constexpr locales
Tanda local de identifier-naming: ningún símbolo cross-file, todo contenido en su propio TU. De paso traduce los catalán/spanish a inglés allá donde aplica. - shape_renderer.cpp: apply_3d_rotation → apply3dRotation, transform_point → transformPoint, perspective_factor → PERSPECTIVE_FACTOR (constexpr). - debris_manager.cpp: transform_point → transformPoint (otro file-static con el mismo nombre, no comparte símbolo con shape_renderer). - logo_scene.cpp: calcular_progress_letra → computeLetterProgress. - vector_text.cpp: char_width/char_height → BASE_CHAR_WIDTH/BASE_CHAR_HEIGHT (el sufijo BASE_ evita el conflicto con la macro CHAR_WIDTH de Windows headers que clang-tidy detectó). - floating_score_manager.cpp::draw: constexpr scale/spacing → SCALE/SPACING. - game_scene.cpp::dibuixar_missatge_stage: escala_base/spacing → BASE_SCALE/SPACING (constexpr locales). - game_scene.cpp::dibuixar_continue: constexpr spacing → SPACING. - game_scene.cpp en stepGameOver: constexpr scale/spacing → SCALE/SPACING. - ship_animator.cpp::actualizar_exiting: constexpr Vec2 punt_fuga → VANISHING_POINT. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
// Constants para mides base dels caràcters
|
// Constants para mides base dels caràcters
|
||||||
constexpr float char_width = 20.0F; // Amplada base del caràcter
|
constexpr float BASE_CHAR_WIDTH = 20.0F; // Amplada base del caràcter
|
||||||
constexpr float char_height = 40.0F; // Altura base del caràcter
|
constexpr float BASE_CHAR_HEIGHT = 40.0F; // Altura base del caràcter
|
||||||
|
|
||||||
VectorText::VectorText(Rendering::Renderer* renderer)
|
VectorText::VectorText(Rendering::Renderer* renderer)
|
||||||
: renderer_(renderer) {
|
: renderer_(renderer) {
|
||||||
@@ -185,16 +185,16 @@ void VectorText::render(const std::string& text, const Vec2& position, float sca
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ancho de un carácter base (20 px a scale 1.0)
|
// Ancho de un carácter base (20 px a scale 1.0)
|
||||||
const float char_width_scaled = char_width * scale;
|
const float char_width_scaled = BASE_CHAR_WIDTH * scale;
|
||||||
|
|
||||||
// Spacing escalado
|
// Spacing escalado
|
||||||
const float spacing_scaled = spacing * scale;
|
const float spacing_scaled = spacing * scale;
|
||||||
|
|
||||||
// Altura de un carácter escalado (necesario para ajustar Y)
|
// Altura de un carácter escalado (necesario para ajustar Y)
|
||||||
const float char_height_scaled = char_height * scale;
|
const float char_height_scaled = BASE_CHAR_HEIGHT * scale;
|
||||||
|
|
||||||
// Posición X del borde izquierdo del carácter actual
|
// Posición X del borde izquierdo del carácter actual
|
||||||
// (se ajustará +char_width/2 para obtener el centro al renderizar)
|
// (se ajustará +BASE_CHAR_WIDTH/2 para obtener el centro al renderizar)
|
||||||
float current_x = position.x;
|
float current_x = position.x;
|
||||||
|
|
||||||
// Iterar sobre cada byte del string (con detecció UTF-8)
|
// Iterar sobre cada byte del string (con detecció UTF-8)
|
||||||
@@ -254,7 +254,7 @@ auto VectorText::get_text_width(const std::string& text, float scale, float spac
|
|||||||
return 0.0F;
|
return 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float char_width_scaled = char_width * scale;
|
const float char_width_scaled = BASE_CHAR_WIDTH * scale;
|
||||||
const float spacing_scaled = spacing * scale;
|
const float spacing_scaled = spacing * scale;
|
||||||
|
|
||||||
// Contar caracteres visuals (no bytes) - manejar UTF-8
|
// Contar caracteres visuals (no bytes) - manejar UTF-8
|
||||||
@@ -277,7 +277,7 @@ auto VectorText::get_text_width(const std::string& text, float scale, float spac
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto VectorText::get_text_height(float scale) const -> float {
|
auto VectorText::get_text_height(float scale) const -> float {
|
||||||
return char_height * scale;
|
return BASE_CHAR_HEIGHT * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Graphics
|
} // namespace Graphics
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
namespace Rendering {
|
namespace Rendering {
|
||||||
|
|
||||||
// Helper: aplicar rotación 3D a un point 2D (assumeix Z=0)
|
// Helper: aplicar rotación 3D a un point 2D (assumeix Z=0)
|
||||||
static auto apply_3d_rotation(float x, float y, const Rotation3D& rot) -> Vec2 {
|
static auto apply3dRotation(float x, float y, const Rotation3D& rot) -> Vec2 {
|
||||||
float z = 0.0F; // Todos los points 2D comencen a Z=0
|
float z = 0.0F; // Todos los points 2D comencen a Z=0
|
||||||
|
|
||||||
// Pitch (rotación eix X): cabeceo arriba/baix
|
// Pitch (rotación eix X): cabeceo arriba/baix
|
||||||
@@ -35,21 +35,21 @@ static auto apply_3d_rotation(float x, float y, const Rotation3D& rot) -> Vec2 {
|
|||||||
// Proyecció perspectiva (Z-divide simple)
|
// Proyecció perspectiva (Z-divide simple)
|
||||||
// Naves quieren hacia el point de fuga (320, 240) a "infinit" (Z → +∞)
|
// Naves quieren hacia el point de fuga (320, 240) a "infinit" (Z → +∞)
|
||||||
// Z més grande = més lluny = més pequeño a pantalla
|
// Z més grande = més lluny = més pequeño a pantalla
|
||||||
constexpr float perspective_factor = 500.0F;
|
constexpr float PERSPECTIVE_FACTOR = 500.0F;
|
||||||
float scale_factor = perspective_factor / (perspective_factor + z2);
|
float scale_factor = PERSPECTIVE_FACTOR / (PERSPECTIVE_FACTOR + z2);
|
||||||
|
|
||||||
return {.x = x3 * scale_factor, .y = y3 * scale_factor};
|
return {.x = x3 * scale_factor, .y = y3 * scale_factor};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper: transformar un point con rotación, scale i traslación
|
// Helper: transformar un point con rotación, scale i traslación
|
||||||
static auto transform_point(const Vec2& point, const Vec2& shape_centre, const Vec2& position, float angle, float scale, const Rotation3D* rotation_3d) -> Vec2 {
|
static auto transformPoint(const Vec2& point, const Vec2& shape_centre, const Vec2& position, float angle, float scale, const Rotation3D* rotation_3d) -> Vec2 {
|
||||||
// 1. Centrar el point respecte al centro de la shape
|
// 1. Centrar el point respecte al centro de la shape
|
||||||
float centered_x = point.x - shape_centre.x;
|
float centered_x = point.x - shape_centre.x;
|
||||||
float centered_y = point.y - shape_centre.y;
|
float centered_y = point.y - shape_centre.y;
|
||||||
|
|
||||||
// 2. Aplicar rotación 3D (si es proporciona)
|
// 2. Aplicar rotación 3D (si es proporciona)
|
||||||
if ((rotation_3d != nullptr) && rotation_3d->has_rotation()) {
|
if ((rotation_3d != nullptr) && rotation_3d->has_rotation()) {
|
||||||
Vec2 rotated_3d = apply_3d_rotation(centered_x, centered_y, *rotation_3d);
|
Vec2 rotated_3d = apply3dRotation(centered_x, centered_y, *rotation_3d);
|
||||||
centered_x = rotated_3d.x;
|
centered_x = rotated_3d.x;
|
||||||
centered_y = rotated_3d.y;
|
centered_y = rotated_3d.y;
|
||||||
}
|
}
|
||||||
@@ -94,14 +94,14 @@ void render_shape(Rendering::Renderer* renderer,
|
|||||||
if (primitive.type == Graphics::PrimitiveType::POLYLINE) {
|
if (primitive.type == Graphics::PrimitiveType::POLYLINE) {
|
||||||
// POLYLINE: conectar puntos consecutivos.
|
// POLYLINE: conectar puntos consecutivos.
|
||||||
for (size_t i = 0; i < primitive.points.size() - 1; i++) {
|
for (size_t i = 0; i < primitive.points.size() - 1; i++) {
|
||||||
const Vec2 P1 = transform_point(primitive.points[i], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
const Vec2 P1 = transformPoint(primitive.points[i], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
||||||
const Vec2 P2 = transform_point(primitive.points[i + 1], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
const Vec2 P2 = transformPoint(primitive.points[i + 1], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
||||||
linea(renderer, static_cast<int>(P1.x), static_cast<int>(P1.y),
|
linea(renderer, static_cast<int>(P1.x), static_cast<int>(P1.y),
|
||||||
static_cast<int>(P2.x), static_cast<int>(P2.y), brightness, 0.0F, color);
|
static_cast<int>(P2.x), static_cast<int>(P2.y), brightness, 0.0F, color);
|
||||||
}
|
}
|
||||||
} else if (primitive.points.size() >= 2) { // LINE
|
} else if (primitive.points.size() >= 2) { // LINE
|
||||||
const Vec2 P1 = transform_point(primitive.points[0], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
const Vec2 P1 = transformPoint(primitive.points[0], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
||||||
const Vec2 P2 = transform_point(primitive.points[1], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
const Vec2 P2 = transformPoint(primitive.points[1], SHAPE_CENTRE, position, angle, scale, rotation_3d);
|
||||||
linea(renderer, static_cast<int>(P1.x), static_cast<int>(P1.y),
|
linea(renderer, static_cast<int>(P1.x), static_cast<int>(P1.y),
|
||||||
static_cast<int>(P2.x), static_cast<int>(P2.y), brightness, 0.0F, color);
|
static_cast<int>(P2.x), static_cast<int>(P2.y), brightness, 0.0F, color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Effects {
|
|||||||
|
|
||||||
// Helper: transformar point con rotación, scale i traslación
|
// Helper: transformar point con rotación, scale i traslación
|
||||||
// (Copiat de shape_renderer.cpp:12-34)
|
// (Copiat de shape_renderer.cpp:12-34)
|
||||||
static auto transform_point(const Vec2& point, const Vec2& shape_centre, const Vec2& position, float angle, float scale) -> Vec2 {
|
static auto transformPoint(const Vec2& point, const Vec2& shape_centre, const Vec2& position, float angle, float scale) -> Vec2 {
|
||||||
// 1. Centrar el point respecte al centro de la shape
|
// 1. Centrar el point respecte al centro de la shape
|
||||||
float centered_x = point.x - shape_centre.x;
|
float centered_x = point.x - shape_centre.x;
|
||||||
float centered_y = point.y - shape_centre.y;
|
float centered_y = point.y - shape_centre.y;
|
||||||
@@ -86,9 +86,9 @@ void DebrisManager::explode(const std::shared_ptr<Graphics::Shape>& shape,
|
|||||||
for (const auto& [local_p1, local_p2] : segments) {
|
for (const auto& [local_p1, local_p2] : segments) {
|
||||||
// 1. Transformar points locals → coordenades mundials
|
// 1. Transformar points locals → coordenades mundials
|
||||||
Vec2 world_p1 =
|
Vec2 world_p1 =
|
||||||
transform_point(local_p1, shape_centre, centro, angle, scale);
|
transformPoint(local_p1, shape_centre, centro, angle, scale);
|
||||||
Vec2 world_p2 =
|
Vec2 world_p2 =
|
||||||
transform_point(local_p2, shape_centre, centro, angle, scale);
|
transformPoint(local_p2, shape_centre, centro, angle, scale);
|
||||||
|
|
||||||
// 2. Trobar slot lliure
|
// 2. Trobar slot lliure
|
||||||
Debris* debris = findFreeSlot();
|
Debris* debris = findFreeSlot();
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ void FloatingScoreManager::draw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Renderizar centrat con brightness (fade)
|
// Renderizar centrat con brightness (fade)
|
||||||
constexpr float scale = Defaults::FloatingScore::SCALE;
|
constexpr float SCALE = Defaults::FloatingScore::SCALE;
|
||||||
constexpr float spacing = Defaults::FloatingScore::SPACING;
|
constexpr float SPACING = Defaults::FloatingScore::SPACING;
|
||||||
|
|
||||||
text_.renderCentered(pf.text, pf.position, scale, spacing, pf.brightness);
|
text_.renderCentered(pf.text, pf.position, SCALE, SPACING, pf.brightness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -528,15 +528,15 @@ void GameScene::draw() {
|
|||||||
|
|
||||||
// Draw centered "GAME OVER" text
|
// Draw centered "GAME OVER" text
|
||||||
const std::string game_over_text = "GAME OVER";
|
const std::string game_over_text = "GAME OVER";
|
||||||
constexpr float scale = Defaults::Game::GameOverScreen::TEXT_SCALE;
|
constexpr float SCALE = Defaults::Game::GameOverScreen::TEXT_SCALE;
|
||||||
constexpr float spacing = Defaults::Game::GameOverScreen::TEXT_SPACING;
|
constexpr float SPACING = Defaults::Game::GameOverScreen::TEXT_SPACING;
|
||||||
|
|
||||||
// Calcular centro de l'àrea de juego usant constants
|
// Calcular centro de l'àrea de juego usant constants
|
||||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||||
float centre_x = play_area.x + (play_area.w / 2.0F);
|
float centre_x = play_area.x + (play_area.w / 2.0F);
|
||||||
float centre_y = play_area.y + (play_area.h / 2.0F);
|
float centre_y = play_area.y + (play_area.h / 2.0F);
|
||||||
|
|
||||||
text_.renderCentered(game_over_text, {.x = centre_x, .y = centre_y}, scale, spacing);
|
text_.renderCentered(game_over_text, {.x = centre_x, .y = centre_y}, SCALE, SPACING);
|
||||||
|
|
||||||
dibuixar_marcador();
|
dibuixar_marcador();
|
||||||
return;
|
return;
|
||||||
@@ -790,8 +790,8 @@ auto GameScene::buildScoreboard() const -> std::string {
|
|||||||
// [NEW] Stage system helper methods
|
// [NEW] Stage system helper methods
|
||||||
|
|
||||||
void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||||
constexpr float escala_base = 1.0F;
|
constexpr float BASE_SCALE = 1.0F;
|
||||||
constexpr float spacing = 2.0F;
|
constexpr float SPACING = 2.0F;
|
||||||
|
|
||||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||||
const float max_width = play_area.w * Defaults::Game::STAGE_MESSAGE_MAX_WIDTH_RATIO;
|
const float max_width = play_area.w * Defaults::Game::STAGE_MESSAGE_MAX_WIDTH_RATIO;
|
||||||
@@ -834,15 +834,15 @@ void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
|||||||
// ===================================================
|
// ===================================================
|
||||||
|
|
||||||
// Calculate text width at base scale (using FULL message for position calculation)
|
// Calculate text width at base scale (using FULL message for position calculation)
|
||||||
float text_width_at_base = text_.get_text_width(message, escala_base, spacing);
|
float text_width_at_base = text_.get_text_width(message, BASE_SCALE, SPACING);
|
||||||
|
|
||||||
// Auto-scale if text exceeds max width
|
// Auto-scale if text exceeds max width
|
||||||
float scale = (text_width_at_base <= max_width)
|
float scale = (text_width_at_base <= max_width)
|
||||||
? escala_base
|
? BASE_SCALE
|
||||||
: max_width / text_width_at_base;
|
: max_width / text_width_at_base;
|
||||||
|
|
||||||
// Recalculate dimensions with final scale (using FULL message for centering)
|
// Recalculate dimensions with final scale (using FULL message for centering)
|
||||||
float full_text_width = text_.get_text_width(message, scale, spacing);
|
float full_text_width = text_.get_text_width(message, scale, SPACING);
|
||||||
float text_height = text_.get_text_height(scale);
|
float text_height = text_.get_text_height(scale);
|
||||||
|
|
||||||
// Calculate position as if FULL text was there (for fixed position typewriter)
|
// Calculate position as if FULL text was there (for fixed position typewriter)
|
||||||
@@ -851,7 +851,7 @@ void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
|||||||
|
|
||||||
// Render only the partial message (typewriter effect)
|
// Render only the partial message (typewriter effect)
|
||||||
Vec2 pos = {.x = x, .y = y};
|
Vec2 pos = {.x = x, .y = y};
|
||||||
text_.render(partial_message, pos, scale, spacing);
|
text_.render(partial_message, pos, scale, SPACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
@@ -910,7 +910,7 @@ void GameScene::disparar_bala(uint8_t player_id) {
|
|||||||
|
|
||||||
void GameScene::dibuixar_continue() {
|
void GameScene::dibuixar_continue() {
|
||||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||||
constexpr float spacing = 4.0F;
|
constexpr float SPACING = 4.0F;
|
||||||
|
|
||||||
// "CONTINUE" text (using constants)
|
// "CONTINUE" text (using constants)
|
||||||
const std::string continue_text = "CONTINUE";
|
const std::string continue_text = "CONTINUE";
|
||||||
@@ -920,7 +920,7 @@ void GameScene::dibuixar_continue() {
|
|||||||
float centre_x = play_area.x + (play_area.w / 2.0F);
|
float centre_x = play_area.x + (play_area.w / 2.0F);
|
||||||
float centre_y_continue = play_area.y + (play_area.h * y_ratio_continue);
|
float centre_y_continue = play_area.y + (play_area.h * y_ratio_continue);
|
||||||
|
|
||||||
text_.renderCentered(continue_text, {.x = centre_x, .y = centre_y_continue}, escala_continue, spacing);
|
text_.renderCentered(continue_text, {.x = centre_x, .y = centre_y_continue}, escala_continue, SPACING);
|
||||||
|
|
||||||
// Countdown number (using constants)
|
// Countdown number (using constants)
|
||||||
const std::string counter_str = std::to_string(continue_counter_);
|
const std::string counter_str = std::to_string(continue_counter_);
|
||||||
@@ -929,7 +929,7 @@ void GameScene::dibuixar_continue() {
|
|||||||
|
|
||||||
float centre_y_counter = play_area.y + (play_area.h * y_ratio_counter);
|
float centre_y_counter = play_area.y + (play_area.h * y_ratio_counter);
|
||||||
|
|
||||||
text_.renderCentered(counter_str, {.x = centre_x, .y = centre_y_counter}, escala_counter, spacing);
|
text_.renderCentered(counter_str, {.x = centre_x, .y = centre_y_counter}, escala_counter, SPACING);
|
||||||
|
|
||||||
// "CONTINUES LEFT" (conditional + using constants)
|
// "CONTINUES LEFT" (conditional + using constants)
|
||||||
if (!Defaults::Game::INFINITE_CONTINUES) {
|
if (!Defaults::Game::INFINITE_CONTINUES) {
|
||||||
@@ -939,7 +939,7 @@ void GameScene::dibuixar_continue() {
|
|||||||
|
|
||||||
float centre_y_info = play_area.y + (play_area.h * y_ratio_info);
|
float centre_y_info = play_area.y + (play_area.h * y_ratio_info);
|
||||||
|
|
||||||
text_.renderCentered(continues_text, {.x = centre_x, .y = centre_y_info}, escala_info, spacing);
|
text_.renderCentered(continues_text, {.x = centre_x, .y = centre_y_info}, escala_info, SPACING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ using Option = SceneContext::Option;
|
|||||||
|
|
||||||
// Helper: calcular el progrés individual de una lletra
|
// Helper: calcular el progrés individual de una lletra
|
||||||
// en función del progrés global (efecte seqüencial)
|
// en función del progrés global (efecte seqüencial)
|
||||||
static auto calcular_progress_letra(size_t letra_index, size_t num_letras, float global_progress, float threshold) -> float {
|
static auto computeLetterProgress(size_t letra_index, size_t num_letras, float global_progress, float threshold) -> float {
|
||||||
if (num_letras == 0) {
|
if (num_letras == 0) {
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,7 @@ void LogoScene::update(float delta_time) {
|
|||||||
|
|
||||||
for (size_t i = 0; i < lletres_.size() && i < so_reproduit_.size(); i++) {
|
for (size_t i = 0; i < lletres_.size() && i < so_reproduit_.size(); i++) {
|
||||||
if (!so_reproduit_[i]) {
|
if (!so_reproduit_[i]) {
|
||||||
float letra_progress = calcular_progress_letra(
|
float letra_progress = computeLetterProgress(
|
||||||
i,
|
i,
|
||||||
lletres_.size(),
|
lletres_.size(),
|
||||||
global_progress,
|
global_progress,
|
||||||
@@ -300,7 +300,7 @@ void LogoScene::draw() {
|
|||||||
for (size_t i = 0; i < lletres_.size(); i++) {
|
for (size_t i = 0; i < lletres_.size(); i++) {
|
||||||
const auto& lletra = lletres_[i];
|
const auto& lletra = lletres_[i];
|
||||||
|
|
||||||
float letra_progress = calcular_progress_letra(
|
float letra_progress = computeLetterProgress(
|
||||||
i,
|
i,
|
||||||
lletres_.size(),
|
lletres_.size(),
|
||||||
global_progress,
|
global_progress,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
namespace StageSystem {
|
namespace StageSystem {
|
||||||
|
|
||||||
// Estats del stage system
|
// Estats del stage system
|
||||||
enum class EstatStage {
|
enum class EstatStage : std::uint8_t {
|
||||||
INIT_HUD, // Animación inicial del HUD (3s)
|
INIT_HUD, // Animación inicial del HUD (3s)
|
||||||
LEVEL_START, // Pantalla "ENEMY INCOMING" (3s)
|
LEVEL_START, // Pantalla "ENEMY INCOMING" (3s)
|
||||||
PLAYING, // Gameplay normal
|
PLAYING, // Gameplay normal
|
||||||
|
|||||||
@@ -233,12 +233,12 @@ void ShipAnimator::actualitzar_exiting(TitleShip& ship, float delta_time) {
|
|||||||
float eased_progress = Easing::ease_in_quad(progress);
|
float eased_progress = Easing::ease_in_quad(progress);
|
||||||
|
|
||||||
// Vec2 de fuga (centro del starfield)
|
// Vec2 de fuga (centro del starfield)
|
||||||
constexpr Vec2 punt_fuga{.x = VANISHING_POINT_X, .y = VANISHING_POINT_Y};
|
constexpr Vec2 VANISHING_POINT{.x = VANISHING_POINT_X, .y = VANISHING_POINT_Y};
|
||||||
|
|
||||||
// Lerp posición hacia el point de fuga (preservar posición inicial actual)
|
// Lerp posición hacia el point de fuga (preservar posición inicial actual)
|
||||||
// Nota: initial_position conté la posición on estava cuando es va activar EXITING
|
// Nota: initial_position conté la posición on estava cuando es va activar EXITING
|
||||||
ship.current_position.x = Easing::lerp(ship.initial_position.x, punt_fuga.x, eased_progress);
|
ship.current_position.x = Easing::lerp(ship.initial_position.x, VANISHING_POINT.x, eased_progress);
|
||||||
ship.current_position.y = Easing::lerp(ship.initial_position.y, punt_fuga.y, eased_progress);
|
ship.current_position.y = Easing::lerp(ship.initial_position.y, VANISHING_POINT.y, eased_progress);
|
||||||
|
|
||||||
// Escala redueix a 0 (simula Z → infinit)
|
// Escala redueix a 0 (simula Z → infinit)
|
||||||
ship.current_scale = ship.target_scale * (1.0F - eased_progress);
|
ship.current_scale = ship.target_scale * (1.0F - eased_progress);
|
||||||
|
|||||||
Reference in New Issue
Block a user