refactor(scenes): renombra ancho/altura/centre_punt residuals a anglès
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user