Afegides les traduccions dels credits

This commit is contained in:
2024-11-27 09:16:17 +01:00
parent 736bf7e544
commit 9f2448753b
5 changed files with 71 additions and 30 deletions

View File

@@ -360,3 +360,15 @@ Temps!
## 120 - SCOREBOARD ## 120 - SCOREBOARD
Puntuacio Puntuacio
## 121 - CREDITS
PROGRAMAT I DISSENYAT PER
## 122 - CREDITS
GRAFICS DIBUIXATS PER
## 123 - CREDITS
MUSICA COMPOSADA PER
## 124 - CREDITS
EFECTES DE SO

View File

@@ -360,3 +360,15 @@ Stop!
## 120 - SCOREBOARD ## 120 - SCOREBOARD
Score Score
## 121 - CREDITS
PROGRAMMED AND DESIGNED BY
## 122 - CREDITS
PIXELART DRAWN BY
## 123 - CREDITS
MUSIC COMPOSED BY
## 124 - CREDITS
SOUND EFFECTS

View File

@@ -360,3 +360,15 @@ Tiempo!
## 120 - SCOREBOARD ## 120 - SCOREBOARD
Puntuacion Puntuacion
## 121 - CREDITS
PROGRAMADO Y DISEÑADO POR
## 122 - CREDITS
GRAFICOS DIBUJADOS POR
## 123 - CREDITS
MUSICA COMPUESTA POR
## 124 - CREDITS
EFECTOS DE SONIDO

View File

@@ -1,27 +1,27 @@
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include "credits.h" #include "credits.h"
#include <SDL2/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND #include <SDL2/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL2/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_QUIT #include <SDL2/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_QUIT
#include <SDL2/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888 #include <SDL2/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_rect.h> // Para SDL_Rect #include <SDL2/SDL_rect.h> // Para SDL_Rect
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks #include <SDL2/SDL_timer.h> // Para SDL_GetTicks
#include <string> // Para basic_string, string #include <algorithm>
#include <vector> // Para vector #include <cstdlib>
#include "balloon_manager.h" // Para BalloonManager #include <string> // Para basic_string, string
#include "global_inputs.h" // Para check #include <vector> // Para vector
#include "input.h" // Para Input #include "balloon_manager.h" // Para BalloonManager
#include "jail_audio.h" // Para JA_PlayMusic, JA_StopMusic #include "global_inputs.h" // Para check
#include "param.h" // Para Param, ParamGame, param #include "input.h" // Para Input
#include "resource.h" // Para Resource #include "jail_audio.h" // Para JA_PlayMusic, JA_StopMusic
#include "screen.h" // Para Screen #include "param.h" // Para Param, ParamGame, param
#include "section.h" // Para Name, name, Options, options #include "resource.h" // Para Resource
#include "text.h" // Para Text, TEXT_CENTER, TEXT_SHADOW #include "screen.h" // Para Screen
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "section.h" // Para Name, name, Options, options
#include "utils.h" // Para Color, no_color, shdw_txt_color, Zone #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 "player.h"
#include "fade.h" #include "fade.h"
#include "lang.h"
// Textos // Textos
constexpr const char TEXT_COPYRIGHT[] = "@2020,2024 JailDesigner"; constexpr const char TEXT_COPYRIGHT[] = "@2020,2024 JailDesigner";
@@ -34,6 +34,10 @@ Credits::Credits()
fade_in_(std::make_unique<Fade>()), fade_in_(std::make_unique<Fade>()),
fade_out_(std::make_unique<Fade>()) fade_out_(std::make_unique<Fade>())
{ {
if (!text_texture_)
{
throw std::runtime_error("Failed to create SDL texture for text.");
}
section::name = section::Name::CREDITS; section::name = section::Name::CREDITS;
top_black_rect_ = {play_area_.x, 0, play_area_.w, black_bars_size_}; 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_}; 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(); initPlayers();
SDL_SetTextureBlendMode(text_texture_, SDL_BLENDMODE_BLEND); SDL_SetTextureBlendMode(text_texture_, SDL_BLENDMODE_BLEND);
fillTextTexture(); 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)); 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_); SDL_RenderCopy(Screen::get()->getRenderer(), text_texture_, &mini_logo_rect_src_, &mini_logo_rect_dst_);
// Dibuja los rectangulos negros // Dibuja los rectangulos negros
// SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0x27, 0x27, 0x36, 255);
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 255); SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 255);
SDL_RenderFillRect(Screen::get()->getRenderer(), &top_black_rect_); SDL_RenderFillRect(Screen::get()->getRenderer(), &top_black_rect_);
SDL_RenderFillRect(Screen::get()->getRenderer(), &bottom_black_rect_); SDL_RenderFillRect(Screen::get()->getRenderer(), &bottom_black_rect_);
SDL_RenderFillRect(Screen::get()->getRenderer(), &left_black_rect_); SDL_RenderFillRect(Screen::get()->getRenderer(), &left_black_rect_);
SDL_RenderFillRect(Screen::get()->getRenderer(), &right_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_) if (mini_logo_on_position_)
{ {
SDL_RenderCopy(Screen::get()->getRenderer(), text_texture_, &mini_logo_rect_src_, &mini_logo_rect_dst_); 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_in_->render();
fade_out_->render(); fade_out_->render();
@@ -188,10 +190,10 @@ void Credits::fillTextTexture()
SDL_RenderClear(Screen::get()->getRenderer()); SDL_RenderClear(Screen::get()->getRenderer());
std::vector<std::string> texts = { std::vector<std::string> texts = {
"PROGRAMACIO I DISSENY", lang::getText(121),
"GRAFICS", lang::getText(122),
"MUSICA", lang::getText(123),
"SONS", lang::getText(124),
"JAILDESIGNER", "JAILDESIGNER",
"JAILDOCTOR (INTRO)", "JAILDOCTOR (INTRO)",
"ERIC MATYAS (SOUNDIMAGE.ORG)", "ERIC MATYAS (SOUNDIMAGE.ORG)",
@@ -257,10 +259,11 @@ void Credits::fillTextTexture()
y += mini_logo_sprite->getHeight() + 3; 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); 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); 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; 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_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; 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<int> sets = {0, 63, 25, 67, 17, 75, 13, 50}; const std::vector<int> sets = {0, 63, 25, 67, 17, 75, 13, 50};
if (counter_ > ((sets.size() - 1) * speed) * 3) if (counter_ > ((sets.size() - 1) * speed) * 3)
{
return; return;
}
if (counter_ % speed == 0) if (counter_ % speed == 0)
{ {

View File

@@ -60,7 +60,7 @@ Director::Director(int argc, const char *argv[])
section::name = section::Name::GAME; section::name = section::Name::GAME;
section::options = section::Options::GAME_PLAY_1P; section::options = section::Options::GAME_PLAY_1P;
#elif DEBUG #elif DEBUG
section::name = section::Name::LOGO; section::name = section::Name::CREDITS;
#else // NORMAL GAME #else // NORMAL GAME
section::name = section::Name::LOGO; section::name = section::Name::LOGO;
section::attract_mode = section::AttractMode::TITLE_TO_DEMO; section::attract_mode = section::AttractMode::TITLE_TO_DEMO;