From 9f2448753b126ec7e44b88f58bed7859edea2d8b Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 27 Nov 2024 09:16:17 +0100 Subject: [PATCH] Afegides les traduccions dels credits --- data/lang/ba_BA.txt | 14 ++++++++++- data/lang/en_UK.txt | 14 ++++++++++- data/lang/es_ES.txt | 14 ++++++++++- source/credits.cpp | 57 ++++++++++++++++++++++++--------------------- source/director.cpp | 2 +- 5 files changed, 71 insertions(+), 30 deletions(-) diff --git a/data/lang/ba_BA.txt b/data/lang/ba_BA.txt index f6ef3ba..3fe701a 100644 --- a/data/lang/ba_BA.txt +++ b/data/lang/ba_BA.txt @@ -359,4 +359,16 @@ SuperPoder! Temps! ## 120 - SCOREBOARD -Puntuacio \ No newline at end of file +Puntuacio + +## 121 - CREDITS +PROGRAMAT I DISSENYAT PER + +## 122 - CREDITS +GRAFICS DIBUIXATS PER + +## 123 - CREDITS +MUSICA COMPOSADA PER + +## 124 - CREDITS +EFECTES DE SO \ No newline at end of file diff --git a/data/lang/en_UK.txt b/data/lang/en_UK.txt index ebf2080..2ebe17d 100644 --- a/data/lang/en_UK.txt +++ b/data/lang/en_UK.txt @@ -359,4 +359,16 @@ PowerUp Stop! ## 120 - SCOREBOARD -Score \ No newline at end of file +Score + +## 121 - CREDITS +PROGRAMMED AND DESIGNED BY + +## 122 - CREDITS +PIXELART DRAWN BY + +## 123 - CREDITS +MUSIC COMPOSED BY + +## 124 - CREDITS +SOUND EFFECTS \ No newline at end of file diff --git a/data/lang/es_ES.txt b/data/lang/es_ES.txt index 086d7e1..a5b82dc 100644 --- a/data/lang/es_ES.txt +++ b/data/lang/es_ES.txt @@ -359,4 +359,16 @@ Potenciador Tiempo! ## 120 - SCOREBOARD -Puntuacion \ No newline at end of file +Puntuacion + +## 121 - CREDITS +PROGRAMADO Y DISEÑADO POR + +## 122 - CREDITS +GRAFICOS DIBUJADOS POR + +## 123 - CREDITS +MUSICA COMPUESTA POR + +## 124 - CREDITS +EFECTOS DE SONIDO \ No newline at end of file diff --git a/source/credits.cpp b/source/credits.cpp index ead2187..d495ee4 100644 --- a/source/credits.cpp +++ b/source/credits.cpp @@ -1,27 +1,27 @@ -#include -#include -#include #include "credits.h" #include // Para SDL_BLENDMODE_BLEND #include // Para SDL_PollEvent, SDL_Event, SDL_QUIT #include // Para SDL_PIXELFORMAT_RGBA8888 #include // Para SDL_Rect #include // Para SDL_GetTicks -#include // Para basic_string, string -#include // Para vector -#include "balloon_manager.h" // Para BalloonManager -#include "global_inputs.h" // Para check -#include "input.h" // Para Input -#include "jail_audio.h" // Para JA_PlayMusic, JA_StopMusic -#include "param.h" // Para Param, ParamGame, param -#include "resource.h" // Para Resource -#include "screen.h" // Para Screen -#include "section.h" // Para Name, name, Options, options -#include "text.h" // Para Text, TEXT_CENTER, TEXT_SHADOW -#include "tiled_bg.h" // Para TiledBG, TiledBGMode -#include "utils.h" // Para Color, no_color, shdw_txt_color, Zone +#include +#include +#include // Para basic_string, string +#include // Para vector +#include "balloon_manager.h" // Para BalloonManager +#include "global_inputs.h" // Para check +#include "input.h" // Para Input +#include "jail_audio.h" // Para JA_PlayMusic, JA_StopMusic +#include "param.h" // Para Param, ParamGame, param +#include "resource.h" // Para Resource +#include "screen.h" // Para Screen +#include "section.h" // Para Name, name, Options, options +#include "text.h" // Para Text, TEXT_CENTER, TEXT_SHADOW +#include "tiled_bg.h" // Para TiledBG, TiledBGMode +#include "utils.h" // Para Color, no_color, shdw_txt_color, Zone #include "player.h" #include "fade.h" +#include "lang.h" // Textos constexpr const char TEXT_COPYRIGHT[] = "@2020,2024 JailDesigner"; @@ -34,6 +34,10 @@ Credits::Credits() fade_in_(std::make_unique()), fade_out_(std::make_unique()) { + if (!text_texture_) + { + throw std::runtime_error("Failed to create SDL texture for text."); + } section::name = section::Name::CREDITS; top_black_rect_ = {play_area_.x, 0, play_area_.w, black_bars_size_}; bottom_black_rect_ = {play_area_.x, param.game.game_area.rect.h - black_bars_size_, play_area_.w, black_bars_size_}; @@ -49,7 +53,6 @@ Credits::Credits() initPlayers(); SDL_SetTextureBlendMode(text_texture_, SDL_BLENDMODE_BLEND); fillTextTexture(); - // JA_PlayMusic(Resource::get()->getMusic("credits.ogg")); steps_ = std::abs((top_black_rect_.h - param.game.game_area.center_y - 1) + ((left_black_rect_.w - param.game.game_area.center_x) / 4)); } @@ -116,20 +119,19 @@ void Credits::render() SDL_RenderCopy(Screen::get()->getRenderer(), text_texture_, &mini_logo_rect_src_, &mini_logo_rect_dst_); // Dibuja los rectangulos negros - // SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0x27, 0x27, 0x36, 255); SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 255); SDL_RenderFillRect(Screen::get()->getRenderer(), &top_black_rect_); SDL_RenderFillRect(Screen::get()->getRenderer(), &bottom_black_rect_); SDL_RenderFillRect(Screen::get()->getRenderer(), &left_black_rect_); SDL_RenderFillRect(Screen::get()->getRenderer(), &right_black_rect_); - // Si el mini_logo está en su destino, lo dibuja encima del resto + // Si el mini_logo está en su destino, lo dibuja encima de lo anterior if (mini_logo_on_position_) { SDL_RenderCopy(Screen::get()->getRenderer(), text_texture_, &mini_logo_rect_src_, &mini_logo_rect_dst_); } - // Dibuja el fade sobre el resto + // Dibuja el fade sobre el resto de elementos fade_in_->render(); fade_out_->render(); @@ -188,10 +190,10 @@ void Credits::fillTextTexture() SDL_RenderClear(Screen::get()->getRenderer()); std::vector texts = { - "PROGRAMACIO I DISSENY", - "GRAFICS", - "MUSICA", - "SONS", + lang::getText(121), + lang::getText(122), + lang::getText(123), + lang::getText(124), "JAILDESIGNER", "JAILDOCTOR (INTRO)", "ERIC MATYAS (SOUNDIMAGE.ORG)", @@ -257,10 +259,11 @@ void Credits::fillTextTexture() y += mini_logo_sprite->getHeight() + 3; text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXT_COPYRIGHT, 1, no_color, 1, shdw_txt_color); - mini_logo_rect_dst_.h = mini_logo_rect_src_.h = mini_logo_sprite->getHeight() + 3 + text->getCharacterSize(); - + // Resetea el renderizador SDL_SetRenderTarget(Screen::get()->getRenderer(), nullptr); + // Actualiza las variables + mini_logo_rect_dst_.h = mini_logo_rect_src_.h = mini_logo_sprite->getHeight() + 3 + text->getCharacterSize(); credits_rect_dst_.y = param.game.game_area.rect.h; mini_logo_rect_dst_.y = credits_rect_dst_.y + credits_rect_dst_.h + 30; mini_logo_final_pos_ = param.game.game_area.center_y - mini_logo_rect_src_.h / 2; @@ -312,7 +315,9 @@ void Credits::throwBalloons() const std::vector sets = {0, 63, 25, 67, 17, 75, 13, 50}; if (counter_ > ((sets.size() - 1) * speed) * 3) + { return; + } if (counter_ % speed == 0) { diff --git a/source/director.cpp b/source/director.cpp index 86d2b67..c577f41 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -60,7 +60,7 @@ Director::Director(int argc, const char *argv[]) section::name = section::Name::GAME; section::options = section::Options::GAME_PLAY_1P; #elif DEBUG - section::name = section::Name::LOGO; + section::name = section::Name::CREDITS; #else // NORMAL GAME section::name = section::Name::LOGO; section::attract_mode = section::AttractMode::TITLE_TO_DEMO;