diff --git a/CMakeLists.txt b/CMakeLists.txt index bdb14ab..d499baf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,7 @@ project(orni VERSION 0.7.2 LANGUAGES CXX) # Info del projecte (font de veritat per a project.h) set(PROJECT_LONG_NAME "Orni Attack") -set(PROJECT_COPYRIGHT_ORIGINAL "© 1999 Visente i Sergi") -set(PROJECT_COPYRIGHT_PORT "© 2025 JailDesigner") -set(PROJECT_COPYRIGHT "${PROJECT_COPYRIGHT_ORIGINAL}, ${PROJECT_COPYRIGHT_PORT}") +set(PROJECT_COPYRIGHT "© 2026 JailDesigner") if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE) diff --git a/source/core/defaults.hpp b/source/core/defaults.hpp index da5552a..4a29379 100644 --- a/source/core/defaults.hpp +++ b/source/core/defaults.hpp @@ -508,6 +508,10 @@ constexpr float COPYRIGHT_LINE_SPACING = 0.0F; // Entre línies copyright (5px) constexpr float LOGO_SCALE = 0.6F; // Escala "ORNI ATTACK!" constexpr float PRESS_START_SCALE = 1.0F; // Escala "PRESS START TO PLAY" constexpr float COPYRIGHT_SCALE = 0.5F; // Escala copyright +constexpr float JAILGAMES_SCALE = 0.25F; // Escala del logo JAILGAMES pequeño sobre el copyright + +// Separación entre el logo JAILGAMES y la línea de copyright (proporción de Game::HEIGHT). +constexpr float JAILGAMES_COPYRIGHT_GAP = 0.015F; // Espaiat entre caràcters (usado per VectorText) constexpr float TEXT_SPACING = 2.0F; diff --git a/source/game/scenes/title_scene.cpp b/source/game/scenes/title_scene.cpp index af8006c..17e24ea 100644 --- a/source/game/scenes/title_scene.cpp +++ b/source/game/scenes/title_scene.cpp @@ -91,6 +91,9 @@ TitleScene::TitleScene(SDLManager& sdl, SceneContext& context) // Inicialitzar lletres del título "ORNI ATTACK!" inicialitzar_titol(); + // Logo JAILGAMES pequeño sobre el copyright inferior. + inicialitzarJailgames(); + // Iniciar música de título si no está sonant if (Audio::getMusicState() != Audio::MusicState::PLAYING) { Audio::get()->playMusic("title.ogg"); @@ -254,6 +257,99 @@ void TitleScene::inicialitzar_titol() { std::cout << "[TitleScene] Animación: Posicions originals guardades\n"; } +void TitleScene::inicialitzarJailgames() { + using namespace Graphics; + + // Mismas letras que la LogoScene, mismo orden (J-A-I-L-G-A-M-E-S). + const std::vector FITXERS = { + "logo/letra_j.shp", + "logo/letra_a.shp", + "logo/letra_i.shp", + "logo/letra_l.shp", + "logo/letra_g.shp", + "logo/letra_a.shp", + "logo/letra_m.shp", + "logo/letra_e.shp", + "logo/letra_s.shp"}; + + constexpr float SCALE = Defaults::Title::Layout::JAILGAMES_SCALE; + + // Pas 1: carregar formes i calcular amplada/altura escalades. + float ancho_total = 0.0F; + float altura_max = 0.0F; + + for (const auto& file : FITXERS) { + auto shape = ShapeLoader::load(file); + if (!shape || !shape->isValid()) { + std::cerr << "[TitleScene] Error carregant " << file << '\n'; + continue; + } + + float min_x = FLT_MAX; + float max_x = -FLT_MAX; + float min_y = FLT_MAX; + float max_y = -FLT_MAX; + for (const auto& prim : shape->get_primitives()) { + for (const auto& point : prim.points) { + min_x = std::min(min_x, point.x); + max_x = std::max(max_x, point.x); + min_y = std::min(min_y, point.y); + 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; + + lletres_jailgames_.push_back({shape, {.x = 0.0F, .y = 0.0F}, + ANCHO, ALTURA, OFFSET_CENTRE}); + + ancho_total += ANCHO; + altura_max = std::max(altura_max, ALTURA); + } + + // Espaiat entre lletres (proporcional a la escala, para que no quede pegado). + constexpr float ESPAI_JAILGAMES = ESPAI_ENTRE_LLETRES * SCALE; + if (!lletres_jailgames_.empty()) { + ancho_total += ESPAI_JAILGAMES * static_cast(lletres_jailgames_.size() - 1); + } + + // Pas 2: centrar horizontalmente y colocar JUST encima de la línea de copyright. + const float Y_COPYRIGHT = 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_COPYRIGHT - GAP - (altura_max / 2.0F); + const float X_INICIAL = (Defaults::Game::WIDTH - ancho_total) / 2.0F; + + float x_actual = X_INICIAL; + for (auto& lletra : lletres_jailgames_) { + lletra.position.x = x_actual + lletra.offset_centre; + lletra.position.y = Y_CENTRE; + x_actual += lletra.ancho + ESPAI_JAILGAMES; + } +} + +void TitleScene::dibuixarPeuTitol(float spacing) const { + // Logo JAILGAMES pequeño sobre el copyright. + for (const auto& lletra : lletres_jailgames_) { + Rendering::render_shape(sdl_.getRenderer(), lletra.shape, + lletra.position, 0.0F, + Defaults::Title::Layout::JAILGAMES_SCALE, + 1.0F); + } + + // Copyright en una sola línea, centrado, en mayúsculas. + std::string copyright = Project::COPYRIGHT; + for (char& c : copyright) { + if (c >= 'a' && c <= 'z') { + c = static_cast(c - 32); + } + } + const float Y_COPY = Defaults::Game::HEIGHT * Defaults::Title::Layout::COPYRIGHT1_POS; + const float CENTRE_X = Defaults::Game::WIDTH / 2.0F; + text_.renderCentered(copyright, {.x = CENTRE_X, .y = Y_COPY}, + Defaults::Title::Layout::COPYRIGHT_SCALE, spacing); +} + auto TitleScene::isFinished() const -> bool { return context_.nextScene() != SceneType::TITLE; } @@ -604,36 +700,7 @@ void TitleScene::draw() { text_.renderCentered(main_text, {.x = centre_x, .y = centre_y}, escala_main, spacing); } - // === 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 - } - } - - // 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 - } - } - - // 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 - - // Renderizar línees centrades - float centre_x = Defaults::Game::WIDTH / 2.0F; - - text_.renderCentered(copyright_original, {.x = centre_x, .y = y_line1}, escala_copy, spacing); - text_.renderCentered(copyright_port, {.x = centre_x, .y = y_line2}, escala_copy, spacing); + dibuixarPeuTitol(spacing); } } diff --git a/source/game/scenes/title_scene.hpp b/source/game/scenes/title_scene.hpp index 826da38..29cafa4 100644 --- a/source/game/scenes/title_scene.hpp +++ b/source/game/scenes/title_scene.hpp @@ -70,6 +70,9 @@ class TitleScene final : public Scene { std::vector lletres_attack_; // Lletres de "ATTACK!" (línia 2) float y_attack_dinamica_; // Posición Y calculada dinàmicament per "ATTACK!" + // Logo "JAILGAMES" pequeño sobre el copyright (esquinas inferiores del título). + std::vector lletres_jailgames_; + // Estat de animación del logo float temps_animacio_; // Temps acumulat per animación orbital std::vector posicions_originals_orni_; // Posicions originals de "ORNI" @@ -111,5 +114,7 @@ class TitleScene final : public Scene { void actualitzar_animacio_logo(float delta_time); // Actualitza l'animación orbital del logo auto checkSkipButtonPressed() -> bool; auto checkStartGameButtonPressed() -> bool; - void inicialitzar_titol(); // Carrega i posiciona las lletres del título + void inicialitzar_titol(); // Carrega i posiciona las lletres del título + void inicialitzarJailgames(); // Carrega i posiciona el logo JAILGAMES pequeño + void dibuixarPeuTitol(float spacing) const; // Logo JAILGAMES + línia de copyright }; diff --git a/source/project.h.in b/source/project.h.in index a336301..34941db 100644 --- a/source/project.h.in +++ b/source/project.h.in @@ -5,7 +5,5 @@ constexpr const char* NAME = "@PROJECT_NAME@"; constexpr const char* LONG_NAME = "@PROJECT_LONG_NAME@"; constexpr const char* VERSION = "@PROJECT_VERSION@"; constexpr const char* COPYRIGHT = "@PROJECT_COPYRIGHT@"; -constexpr const char* COPYRIGHT_ORIGINAL = "@PROJECT_COPYRIGHT_ORIGINAL@"; -constexpr const char* COPYRIGHT_PORT = "@PROJECT_COPYRIGHT_PORT@"; constexpr const char* GIT_HASH = "@GIT_HASH@"; } // namespace Project