refactor(scenes): renombra ancho/altura/centre_punt residuals a anglès
This commit is contained in:
@@ -235,7 +235,7 @@ namespace Graphics {
|
||||
}
|
||||
}
|
||||
|
||||
void VectorText::renderCentered(const std::string& text, const Vec2& centre_punt, float scale, float spacing, float brightness, SDL_Color color) const {
|
||||
void VectorText::renderCentered(const std::string& text, const Vec2& centre_point, float scale, float spacing, float brightness, SDL_Color color) const {
|
||||
// Calcular dimensions del text
|
||||
float text_width = getTextWidth(text, scale, spacing);
|
||||
float text_height = getTextHeight(scale);
|
||||
@@ -243,8 +243,8 @@ namespace Graphics {
|
||||
// Calcular posición de l'esquina superior izquierda
|
||||
// restant la meitat de las dimensions del point central
|
||||
Vec2 top_left_position = {
|
||||
.x = centre_punt.x - (text_width / 2.0F),
|
||||
.y = centre_punt.y - (text_height / 2.0F)};
|
||||
.x = centre_point.x - (text_width / 2.0F),
|
||||
.y = centre_point.y - (text_height / 2.0F)};
|
||||
|
||||
// Delegar al método render() existent
|
||||
render(text, top_left_position, scale, spacing, brightness, color);
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace Graphics {
|
||||
|
||||
// Renderizar string centrado en un punto
|
||||
// - text: cadena a renderizar
|
||||
// - centre_punt: punto central del texto (no esquina superior izquierda)
|
||||
// - centre_point: punto central del texto (no esquina superior izquierda)
|
||||
// - scale: factor de scale (1.0 = 20×40 px por carácter)
|
||||
// - spacing: espacio entre caracteres en píxeles (a scale 1.0)
|
||||
// - brightness: factor de brightness (0.0-1.0, default 1.0 = màxima brightness)
|
||||
// - color: color RGBA explícit; si alpha==0 (default) s'usa l'oscil·lador global
|
||||
void renderCentered(const std::string& text, const Vec2& centre_punt, float scale = 1.0F, float spacing = 2.0F, float brightness = 1.0F, SDL_Color color = {0, 0, 0, 0}) const;
|
||||
void renderCentered(const std::string& text, const Vec2& centre_point, float scale = 1.0F, float spacing = 2.0F, float brightness = 1.0F, SDL_Color color = {0, 0, 0, 0}) const;
|
||||
|
||||
// Calcular ancho total de un string (útil para centrado).
|
||||
// Es estático: no depende del estado del VectorText (el ancho viene de
|
||||
|
||||
@@ -20,14 +20,14 @@ using SceneManager::SceneContext;
|
||||
using SceneType = SceneContext::SceneType;
|
||||
using Option = SceneContext::Option;
|
||||
|
||||
// Helper: calcular el progrés individual de una lletra
|
||||
// Helper: calcular el progrés individual de una letter
|
||||
// en función del progrés global (efecte seqüencial)
|
||||
static auto computeLetterProgress(size_t letra_index, size_t num_letras, float global_progress, float threshold) -> float {
|
||||
if (num_letras == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
// Calcular time per lletra
|
||||
// Calcular time per letter
|
||||
float duration_per_letra = 1.0F / static_cast<float>(num_letras);
|
||||
float step = threshold * duration_per_letra;
|
||||
float start = static_cast<float>(letra_index) * step;
|
||||
@@ -90,7 +90,7 @@ void LogoScene::initLetters() {
|
||||
"logo/letra_s.shp"};
|
||||
|
||||
// Pas 1: Carregar todas las formes i calcular amplades
|
||||
float ancho_total = 0.0F;
|
||||
float total_width = 0.0F;
|
||||
|
||||
for (const auto& file : archivos) {
|
||||
auto shape = ShapeLoader::load(file);
|
||||
@@ -110,47 +110,47 @@ void LogoScene::initLetters() {
|
||||
}
|
||||
}
|
||||
|
||||
float ancho_sin_escalar = max_x - min_x;
|
||||
float width_unscaled = max_x - min_x;
|
||||
|
||||
// IMPORTANT: Escalar ancho i offset con FINAL_SCALE
|
||||
// per que las posicions finals coincideixin con la mida real de las lletres
|
||||
float ancho = ancho_sin_escalar * FINAL_SCALE;
|
||||
float width = width_unscaled * FINAL_SCALE;
|
||||
float center_offset = (shape->getCenter().x - min_x) * FINAL_SCALE;
|
||||
|
||||
letters_.push_back({shape,
|
||||
{.x = 0.0F, .y = 0.0F}, // Posición es calcularà después
|
||||
ancho,
|
||||
width,
|
||||
center_offset});
|
||||
|
||||
ancho_total += ancho;
|
||||
total_width += width;
|
||||
}
|
||||
|
||||
// Pas 2: Añadir espaiat entre lletres
|
||||
ancho_total += LETTER_SPACING * (letters_.size() - 1);
|
||||
total_width += LETTER_SPACING * (letters_.size() - 1);
|
||||
|
||||
// Pas 3: Calcular posición inicial (centrat horitzontal)
|
||||
constexpr auto PANTALLA_ANCHO = static_cast<float>(Defaults::Game::WIDTH);
|
||||
constexpr auto SCREEN_WIDTH = static_cast<float>(Defaults::Game::WIDTH);
|
||||
constexpr auto PANTALLA_ALTO = static_cast<float>(Defaults::Game::HEIGHT);
|
||||
|
||||
float x_inicial = (PANTALLA_ANCHO - ancho_total) / 2.0F;
|
||||
float x_inicial = (SCREEN_WIDTH - total_width) / 2.0F;
|
||||
float y_centre = PANTALLA_ALTO / 2.0F;
|
||||
|
||||
// Pas 4: Assignar posicions a cada lletra
|
||||
// Pas 4: Assignar posicions a cada letter
|
||||
float x_actual = x_inicial;
|
||||
|
||||
for (auto& lletra : letters_) {
|
||||
for (auto& letter : letters_) {
|
||||
// Posicionar el centro de la shape (shape_centre) en pantalla
|
||||
// Usar center_offset en lloc de ancho/2 perquè shape_centre
|
||||
// pot no estar exactament al mig del bounding box
|
||||
lletra.position.x = x_actual + lletra.center_offset;
|
||||
lletra.position.y = y_centre;
|
||||
letter.position.x = x_actual + letter.center_offset;
|
||||
letter.position.y = y_centre;
|
||||
|
||||
// Avançar para següent lletra
|
||||
x_actual += lletra.ancho + LETTER_SPACING;
|
||||
// Avançar para següent letter
|
||||
x_actual += letter.width + LETTER_SPACING;
|
||||
}
|
||||
|
||||
std::cout << "[LogoScene] " << letters_.size()
|
||||
<< " lletres carregades, ancho total: " << ancho_total << " px\n";
|
||||
<< " lletres carregades, ancho total: " << total_width << " px\n";
|
||||
}
|
||||
|
||||
void LogoScene::changeState(AnimationState nou_estat) {
|
||||
@@ -186,16 +186,16 @@ auto LogoScene::allLettersComplete() const -> bool {
|
||||
void LogoScene::updateExplosions(float delta_time) {
|
||||
time_since_last_explosion_ += delta_time;
|
||||
|
||||
// Comprovar si es el moment de explode la següent lletra
|
||||
// Comprovar si es el moment de explode la següent letter
|
||||
if (time_since_last_explosion_ >= DELAY_ENTRE_EXPLOSIONS) {
|
||||
if (letter_explosion_index_ < letters_.size()) {
|
||||
// Explotar lletra actual (en ordre aleatori)
|
||||
// Explotar letter actual (en ordre aleatori)
|
||||
size_t index_actual = explosion_order_[letter_explosion_index_];
|
||||
const auto& lletra = letters_[index_actual];
|
||||
const auto& letter = letters_[index_actual];
|
||||
|
||||
debris_manager_->explode(
|
||||
lletra.shape, // Forma a explode
|
||||
lletra.position, // Posición
|
||||
letter.shape, // Forma a explode
|
||||
letter.position, // Posición
|
||||
0.0F, // Angle (sin rotación)
|
||||
FINAL_SCALE, // Escala (lletres a scale final)
|
||||
SPEED_EXPLOSIO, // Velocidad base
|
||||
@@ -203,9 +203,9 @@ void LogoScene::updateExplosions(float delta_time) {
|
||||
{.x = 0.0F, .y = 0.0F} // Sin velocity (per defecte)
|
||||
);
|
||||
|
||||
std::cout << "[LogoScene] Explota lletra " << letter_explosion_index_ << "\n";
|
||||
std::cout << "[LogoScene] Explota letter " << letter_explosion_index_ << "\n";
|
||||
|
||||
// Passar a la següent lletra
|
||||
// Passar a la següent letter
|
||||
letter_explosion_index_++;
|
||||
time_since_last_explosion_ = 0.0F;
|
||||
} else {
|
||||
@@ -226,7 +226,7 @@ void LogoScene::update(float delta_time) {
|
||||
break;
|
||||
|
||||
case AnimationState::ANIMATION: {
|
||||
// Reproduir so per cada lletra cuando comença a aparèixer
|
||||
// Reproduir so per cada letter cuando comença a aparèixer
|
||||
float global_progress = std::min(temps_current_state_ / DURATION_ZOOM, 1.0F);
|
||||
|
||||
for (size_t i = 0; i < letters_.size() && i < sound_played_.size(); i++) {
|
||||
@@ -237,7 +237,7 @@ void LogoScene::update(float delta_time) {
|
||||
global_progress,
|
||||
LETTER_THRESHOLD);
|
||||
|
||||
// Reproduir so cuando la lletra comença a aparèixer (progress > 0)
|
||||
// Reproduir so cuando la letter comença a aparèixer (progress > 0)
|
||||
if (letra_progress > 0.0F) {
|
||||
Audio::get()->playSound(Defaults::Sound::LOGO, Audio::Group::GAME);
|
||||
sound_played_[i] = true;
|
||||
@@ -297,7 +297,7 @@ void LogoScene::draw() {
|
||||
const Vec2 ORIGEN_ZOOM = {.x = ORIGEN_ZOOM_X, .y = ORIGEN_ZOOM_Y};
|
||||
|
||||
for (size_t i = 0; i < letters_.size(); i++) {
|
||||
const auto& lletra = letters_[i];
|
||||
const auto& letter = letters_[i];
|
||||
|
||||
float letra_progress = computeLetterProgress(
|
||||
i,
|
||||
@@ -311,9 +311,9 @@ void LogoScene::draw() {
|
||||
|
||||
Vec2 pos_actual;
|
||||
pos_actual.x =
|
||||
ORIGEN_ZOOM.x + ((lletra.position.x - ORIGEN_ZOOM.x) * letra_progress);
|
||||
ORIGEN_ZOOM.x + ((letter.position.x - ORIGEN_ZOOM.x) * letra_progress);
|
||||
pos_actual.y =
|
||||
ORIGEN_ZOOM.y + ((lletra.position.y - ORIGEN_ZOOM.y) * letra_progress);
|
||||
ORIGEN_ZOOM.y + ((letter.position.y - ORIGEN_ZOOM.y) * letra_progress);
|
||||
|
||||
float t = letra_progress;
|
||||
float ease_factor = 1.0F - ((1.0F - t) * (1.0F - t));
|
||||
@@ -322,7 +322,7 @@ void LogoScene::draw() {
|
||||
|
||||
Rendering::renderShape(
|
||||
sdl_.getRenderer(),
|
||||
lletra.shape,
|
||||
letter.shape,
|
||||
pos_actual,
|
||||
0.0F,
|
||||
current_scale,
|
||||
@@ -341,12 +341,12 @@ void LogoScene::draw() {
|
||||
// Dibuixar solo lletres que NO han explotat
|
||||
for (size_t i = 0; i < letters_.size(); i++) {
|
||||
if (!explotades.contains(i)) {
|
||||
const auto& lletra = letters_[i];
|
||||
const auto& letter = letters_[i];
|
||||
|
||||
Rendering::renderShape(
|
||||
sdl_.getRenderer(),
|
||||
lletra.shape,
|
||||
lletra.position,
|
||||
letter.shape,
|
||||
letter.position,
|
||||
0.0F,
|
||||
FINAL_SCALE,
|
||||
1.0F);
|
||||
|
||||
@@ -50,22 +50,22 @@ class LogoScene final : public Scene {
|
||||
std::unique_ptr<Effects::DebrisManager> debris_manager_;
|
||||
|
||||
// Seguiment de explosions seqüencials
|
||||
size_t letter_explosion_index_{0}; // Índex de la següent lletra a explode
|
||||
size_t letter_explosion_index_{0}; // Índex de la següent letter a explode
|
||||
float time_since_last_explosion_{0.0F}; // Temps desde l'última explosión
|
||||
std::vector<size_t> explosion_order_; // Ordre aleatori de índexs de lletres
|
||||
|
||||
// Estructura para cada lletra del logo
|
||||
// Estructura para cada letter del logo
|
||||
struct LogoLetter {
|
||||
std::shared_ptr<Graphics::Shape> shape;
|
||||
Vec2 position; // Posición final en pantalla
|
||||
float ancho; // Ancho del bounding box
|
||||
float width; // Ancho del bounding box
|
||||
float center_offset; // Distancia de min_x a shape_centre.x
|
||||
};
|
||||
|
||||
std::vector<LogoLetter> letters_; // 9 lletres: J-A-I-L-G-A-M-E-S
|
||||
|
||||
// Seguiment de sons de lletres (evitar reproduccions repetides)
|
||||
std::array<bool, 9> sound_played_; // Track si cada lletra ya ha reproduit el so
|
||||
std::array<bool, 9> sound_played_; // Track si cada letter ya ha reproduit el so
|
||||
|
||||
// Constants de animación
|
||||
static constexpr float DURATION_PRE = 1.5F; // Duració PRE_ANIMATION (pantalla negra)
|
||||
@@ -79,7 +79,7 @@ class LogoScene final : public Scene {
|
||||
static constexpr float LETTER_SPACING = 10.0F; // Espaiat entre lletres
|
||||
|
||||
// Constants de animación seqüencial
|
||||
static constexpr float LETTER_THRESHOLD = 0.6F; // Umbral per activar següent lletra (0.0-1.0)
|
||||
static constexpr float LETTER_THRESHOLD = 0.6F; // Umbral per activar següent letter (0.0-1.0)
|
||||
static constexpr float ORIGEN_ZOOM_X = Defaults::Game::WIDTH * 0.5F; // Vec2 inicial X del zoom
|
||||
static constexpr float ORIGEN_ZOOM_Y = Defaults::Game::HEIGHT * 0.4F; // Vec2 inicial Y del zoom
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ void TitleScene::initTitle() {
|
||||
"title/letra_n.shp",
|
||||
"title/letra_i.shp"};
|
||||
|
||||
float ancho_total_orni = 0.0F;
|
||||
float total_width_orni = 0.0F;
|
||||
for (const auto& file : FITXERS_ORNI) {
|
||||
auto shape = ShapeLoader::load(file);
|
||||
if (!shape || !shape->isValid()) {
|
||||
@@ -122,25 +122,25 @@ void TitleScene::initTitle() {
|
||||
max_y = std::max(max_y, point.y);
|
||||
}
|
||||
}
|
||||
const float ANCHO = (max_x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float ALTURA = (max_y - min_y) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float OFFSET_CENTRE = (shape->getCenter().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
letters_orni_.push_back({shape, {.x = 0.0F, .y = 0.0F}, ANCHO, ALTURA, OFFSET_CENTRE});
|
||||
ancho_total_orni += ANCHO;
|
||||
const float WIDTH = (max_x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float HEIGHT = (max_y - min_y) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float CENTER_OFFSET = (shape->getCenter().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
letters_orni_.push_back({shape, {.x = 0.0F, .y = 0.0F}, WIDTH, HEIGHT, CENTER_OFFSET});
|
||||
total_width_orni += WIDTH;
|
||||
}
|
||||
ancho_total_orni += LETTER_SPACING * static_cast<float>(letters_orni_.size() - 1);
|
||||
total_width_orni += LETTER_SPACING * static_cast<float>(letters_orni_.size() - 1);
|
||||
|
||||
float x_actual = (Defaults::Game::WIDTH - ancho_total_orni) / 2.0F;
|
||||
for (auto& lletra : letters_orni_) {
|
||||
lletra.position.x = x_actual + lletra.center_offset;
|
||||
lletra.position.y = Defaults::Game::HEIGHT * Defaults::Title::Layout::LOGO_POS;
|
||||
x_actual += lletra.ancho + LETTER_SPACING;
|
||||
float x_actual = (Defaults::Game::WIDTH - total_width_orni) / 2.0F;
|
||||
for (auto& letter : letters_orni_) {
|
||||
letter.position.x = x_actual + letter.center_offset;
|
||||
letter.position.y = Defaults::Game::HEIGHT * Defaults::Title::Layout::LOGO_POS;
|
||||
x_actual += letter.width + LETTER_SPACING;
|
||||
}
|
||||
|
||||
const float ALTURA_ORNI = letters_orni_.empty() ? 50.0F : letters_orni_[0].altura;
|
||||
const float ORNI_HEIGHT = letters_orni_.empty() ? 50.0F : letters_orni_[0].height;
|
||||
const float Y_ORNI = Defaults::Game::HEIGHT * Defaults::Title::Layout::LOGO_POS;
|
||||
const float SEPARACION = Defaults::Game::HEIGHT * Defaults::Title::Layout::LOGO_LINE_SPACING;
|
||||
dynamic_attack_y_ = Y_ORNI + ALTURA_ORNI + SEPARACION;
|
||||
dynamic_attack_y_ = Y_ORNI + ORNI_HEIGHT + SEPARACION;
|
||||
|
||||
const std::vector<std::string> FITXERS_ATTACK = {
|
||||
"title/letra_a.shp",
|
||||
@@ -151,7 +151,7 @@ void TitleScene::initTitle() {
|
||||
"title/letra_k.shp",
|
||||
"title/letra_exclamacion.shp"};
|
||||
|
||||
float ancho_total_attack = 0.0F;
|
||||
float total_width_attack = 0.0F;
|
||||
for (const auto& file : FITXERS_ATTACK) {
|
||||
auto shape = ShapeLoader::load(file);
|
||||
if (!shape || !shape->isValid()) {
|
||||
@@ -170,28 +170,28 @@ void TitleScene::initTitle() {
|
||||
max_y = std::max(max_y, point.y);
|
||||
}
|
||||
}
|
||||
const float ANCHO = (max_x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float ALTURA = (max_y - min_y) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float OFFSET_CENTRE = (shape->getCenter().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
letters_attack_.push_back({shape, {.x = 0.0F, .y = 0.0F}, ANCHO, ALTURA, OFFSET_CENTRE});
|
||||
ancho_total_attack += ANCHO;
|
||||
const float WIDTH = (max_x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float HEIGHT = (max_y - min_y) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
const float CENTER_OFFSET = (shape->getCenter().x - min_x) * Defaults::Title::Layout::LOGO_SCALE;
|
||||
letters_attack_.push_back({shape, {.x = 0.0F, .y = 0.0F}, WIDTH, HEIGHT, CENTER_OFFSET});
|
||||
total_width_attack += WIDTH;
|
||||
}
|
||||
ancho_total_attack += LETTER_SPACING * static_cast<float>(letters_attack_.size() - 1);
|
||||
total_width_attack += LETTER_SPACING * static_cast<float>(letters_attack_.size() - 1);
|
||||
|
||||
x_actual = (Defaults::Game::WIDTH - ancho_total_attack) / 2.0F;
|
||||
for (auto& lletra : letters_attack_) {
|
||||
lletra.position.x = x_actual + lletra.center_offset;
|
||||
lletra.position.y = dynamic_attack_y_;
|
||||
x_actual += lletra.ancho + LETTER_SPACING;
|
||||
x_actual = (Defaults::Game::WIDTH - total_width_attack) / 2.0F;
|
||||
for (auto& letter : letters_attack_) {
|
||||
letter.position.x = x_actual + letter.center_offset;
|
||||
letter.position.y = dynamic_attack_y_;
|
||||
x_actual += letter.width + LETTER_SPACING;
|
||||
}
|
||||
|
||||
original_positions_orni_.clear();
|
||||
for (const auto& lletra : letters_orni_) {
|
||||
original_positions_orni_.push_back(lletra.position);
|
||||
for (const auto& letter : letters_orni_) {
|
||||
original_positions_orni_.push_back(letter.position);
|
||||
}
|
||||
original_positions_attack_.clear();
|
||||
for (const auto& lletra : letters_attack_) {
|
||||
original_positions_attack_.push_back(lletra.position);
|
||||
for (const auto& letter : letters_attack_) {
|
||||
original_positions_attack_.push_back(letter.position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,8 +211,8 @@ void TitleScene::inicialitzarJailgames() {
|
||||
|
||||
constexpr float SCALE = Defaults::Title::Layout::JAILGAMES_SCALE;
|
||||
|
||||
float ancho_total = 0.0F;
|
||||
float altura_max = 0.0F;
|
||||
float total_width = 0.0F;
|
||||
float max_height = 0.0F;
|
||||
for (const auto& file : FITXERS) {
|
||||
auto shape = ShapeLoader::load(file);
|
||||
if (!shape || !shape->isValid()) {
|
||||
@@ -231,28 +231,28 @@ void TitleScene::inicialitzarJailgames() {
|
||||
max_y = std::max(max_y, point.y);
|
||||
}
|
||||
}
|
||||
const float ANCHO = (max_x - min_x) * SCALE;
|
||||
const float ALTURA = (max_y - min_y) * SCALE;
|
||||
const float OFFSET_CENTRE = (shape->getCenter().x - min_x) * SCALE;
|
||||
letters_jailgames_.push_back({shape, {.x = 0.0F, .y = 0.0F}, ANCHO, ALTURA, OFFSET_CENTRE});
|
||||
ancho_total += ANCHO;
|
||||
altura_max = std::max(altura_max, ALTURA);
|
||||
const float WIDTH = (max_x - min_x) * SCALE;
|
||||
const float HEIGHT = (max_y - min_y) * SCALE;
|
||||
const float CENTER_OFFSET = (shape->getCenter().x - min_x) * SCALE;
|
||||
letters_jailgames_.push_back({shape, {.x = 0.0F, .y = 0.0F}, WIDTH, HEIGHT, CENTER_OFFSET});
|
||||
total_width += WIDTH;
|
||||
max_height = std::max(max_height, HEIGHT);
|
||||
}
|
||||
constexpr float ESPAI_JAILGAMES = LETTER_SPACING * SCALE;
|
||||
constexpr float JAILGAMES_SPACING = LETTER_SPACING * SCALE;
|
||||
if (!letters_jailgames_.empty()) {
|
||||
ancho_total += ESPAI_JAILGAMES * static_cast<float>(letters_jailgames_.size() - 1);
|
||||
total_width += JAILGAMES_SPACING * static_cast<float>(letters_jailgames_.size() - 1);
|
||||
}
|
||||
|
||||
const float Y_COPY = Defaults::Game::HEIGHT * Defaults::Title::Layout::COPYRIGHT1_POS;
|
||||
const float GAP = Defaults::Game::HEIGHT * Defaults::Title::Layout::JAILGAMES_COPYRIGHT_GAP;
|
||||
const float Y_CENTRE = Y_COPY - GAP - (altura_max / 2.0F);
|
||||
const float X_INICIAL = (Defaults::Game::WIDTH - ancho_total) / 2.0F;
|
||||
const float Y_CENTRE = Y_COPY - GAP - (max_height / 2.0F);
|
||||
const float X_INICIAL = (Defaults::Game::WIDTH - total_width) / 2.0F;
|
||||
|
||||
float x_actual = X_INICIAL;
|
||||
for (auto& lletra : letters_jailgames_) {
|
||||
lletra.position.x = x_actual + lletra.center_offset;
|
||||
lletra.position.y = Y_CENTRE;
|
||||
x_actual += lletra.ancho + ESPAI_JAILGAMES;
|
||||
for (auto& letter : letters_jailgames_) {
|
||||
letter.position.x = x_actual + letter.center_offset;
|
||||
letter.position.y = Y_CENTRE;
|
||||
x_actual += letter.width + JAILGAMES_SPACING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,12 +268,12 @@ void TitleScene::dibuixarPeuTitol(float spacing) const {
|
||||
const float COPYRIGHT_S = std::lerp(S::FOOTER_INTRO_SCALE_START, 1.0F, Easing::easeOutQuad(intro_copyright_progress_));
|
||||
|
||||
const float JAILGAMES_RENDER_SCALE = Defaults::Title::Layout::JAILGAMES_SCALE * JAILGAMES_S;
|
||||
for (const auto& lletra : letters_jailgames_) {
|
||||
for (const auto& letter : letters_jailgames_) {
|
||||
const Vec2 POS{
|
||||
.x = SCREEN_CENTRE_X + (JAILGAMES_S * (lletra.position.x - SCREEN_CENTRE_X)),
|
||||
.y = SCREEN_CENTRE_Y + (JAILGAMES_S * (lletra.position.y - SCREEN_CENTRE_Y)),
|
||||
.x = SCREEN_CENTRE_X + (JAILGAMES_S * (letter.position.x - SCREEN_CENTRE_X)),
|
||||
.y = SCREEN_CENTRE_Y + (JAILGAMES_S * (letter.position.y - SCREEN_CENTRE_Y)),
|
||||
};
|
||||
Rendering::renderShape(sdl_.getRenderer(), lletra.shape, POS, 0.0F, JAILGAMES_RENDER_SCALE, 1.0F, 1.0F, Defaults::Title::Colors::JAILGAMES_LOGO);
|
||||
Rendering::renderShape(sdl_.getRenderer(), letter.shape, POS, 0.0F, JAILGAMES_RENDER_SCALE, 1.0F, 1.0F, Defaults::Title::Colors::JAILGAMES_LOGO);
|
||||
}
|
||||
std::string copyright = Project::COPYRIGHT;
|
||||
for (char& c : copyright) {
|
||||
@@ -578,19 +578,19 @@ void TitleScene::draw() {
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& lletra : letters_orni_) {
|
||||
for (const auto& letter : letters_orni_) {
|
||||
const Vec2 POS{
|
||||
.x = SCREEN_CENTRE_X + (LOGO_S * (lletra.position.x - SCREEN_CENTRE_X)),
|
||||
.y = SCREEN_CENTRE_Y + (LOGO_S * (lletra.position.y - SCREEN_CENTRE_Y)),
|
||||
.x = SCREEN_CENTRE_X + (LOGO_S * (letter.position.x - SCREEN_CENTRE_X)),
|
||||
.y = SCREEN_CENTRE_Y + (LOGO_S * (letter.position.y - SCREEN_CENTRE_Y)),
|
||||
};
|
||||
Rendering::renderShape(sdl_.getRenderer(), lletra.shape, POS, 0.0F, LOGO_RENDER_SCALE, 1.0F, 1.0F, Defaults::Title::Colors::LOGO_MAIN);
|
||||
Rendering::renderShape(sdl_.getRenderer(), letter.shape, POS, 0.0F, LOGO_RENDER_SCALE, 1.0F, 1.0F, Defaults::Title::Colors::LOGO_MAIN);
|
||||
}
|
||||
for (const auto& lletra : letters_attack_) {
|
||||
for (const auto& letter : letters_attack_) {
|
||||
const Vec2 POS{
|
||||
.x = SCREEN_CENTRE_X + (LOGO_S * (lletra.position.x - SCREEN_CENTRE_X)),
|
||||
.y = SCREEN_CENTRE_Y + (LOGO_S * (lletra.position.y - SCREEN_CENTRE_Y)),
|
||||
.x = SCREEN_CENTRE_X + (LOGO_S * (letter.position.x - SCREEN_CENTRE_X)),
|
||||
.y = SCREEN_CENTRE_Y + (LOGO_S * (letter.position.y - SCREEN_CENTRE_Y)),
|
||||
};
|
||||
Rendering::renderShape(sdl_.getRenderer(), lletra.shape, POS, 0.0F, LOGO_RENDER_SCALE, 1.0F, 1.0F, Defaults::Title::Colors::LOGO_MAIN);
|
||||
Rendering::renderShape(sdl_.getRenderer(), letter.shape, POS, 0.0F, LOGO_RENDER_SCALE, 1.0F, 1.0F, Defaults::Title::Colors::LOGO_MAIN);
|
||||
}
|
||||
|
||||
const float SPACING = Defaults::Title::Layout::TEXT_SPACING;
|
||||
|
||||
@@ -51,8 +51,8 @@ class TitleScene final : public Scene {
|
||||
struct LogoLetter {
|
||||
std::shared_ptr<Graphics::Shape> shape;
|
||||
Vec2 position;
|
||||
float ancho;
|
||||
float altura;
|
||||
float width;
|
||||
float height;
|
||||
float center_offset;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user