Mes renames. Mes ordre.
This commit is contained in:
@@ -23,41 +23,40 @@ struct JA_Music_t;
|
||||
|
||||
// Constructor
|
||||
Instructions::Instructions(JA_Music_t *music)
|
||||
: music(music)
|
||||
: music_(music)
|
||||
{
|
||||
// Copia los punteros
|
||||
renderer = Screen::get()->getRenderer();
|
||||
renderer_ = Screen::get()->getRenderer();
|
||||
|
||||
// Crea objetos
|
||||
eventHandler = std::make_unique<SDL_Event>();
|
||||
text = std::make_unique<Text>(Asset::get()->get("smb2.gif"), Asset::get()->get("smb2.txt"), renderer);
|
||||
tiledbg = std::make_unique<Tiledbg>(Asset::get()->get("title_bg_tile.png"), (SDL_Rect){0, 0, param.game.width, param.game.height}, TILED_MODE_STATIC);
|
||||
fade = std::make_unique<Fade>(renderer);
|
||||
text_ = std::make_unique<Text>(Asset::get()->get("smb2.gif"), Asset::get()->get("smb2.txt"), renderer_);
|
||||
tiled_bg_ = std::make_unique<Tiledbg>(Asset::get()->get("title_bg_tile.png"), (SDL_Rect){0, 0, param.game.width, param.game.height}, TILED_MODE_STATIC);
|
||||
fade_ = std::make_unique<Fade>(renderer_);
|
||||
|
||||
// Crea un backbuffer para el renderizador
|
||||
backbuffer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height);
|
||||
SDL_SetTextureBlendMode(backbuffer, SDL_BLENDMODE_BLEND);
|
||||
backbuffer_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height);
|
||||
SDL_SetTextureBlendMode(backbuffer_, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Crea una textura para el texto fijo
|
||||
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height);
|
||||
SDL_SetTextureBlendMode(texture_, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Inicializa variables
|
||||
section::name = section::Name::INSTRUCTIONS;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
counter = 0;
|
||||
counterEnd = 700;
|
||||
view = {0, 0, param.game.width, param.game.height};
|
||||
spritePos = {0, 0};
|
||||
itemSpace = 2;
|
||||
ticks_ = 0;
|
||||
ticks_speed_ = 15;
|
||||
counter_ = 0;
|
||||
counter_end_ = 700;
|
||||
view_ = {0, 0, param.game.width, param.game.height};
|
||||
sprite_pos_ = {0, 0};
|
||||
item_space_ = 2;
|
||||
|
||||
// Inicializa objetos
|
||||
fade->setColor(fade_color.r, fade_color.g, fade_color.b);
|
||||
fade->setType(FadeType::FULLSCREEN);
|
||||
fade->setPost(param.fade.post_duration);
|
||||
fade->setMode(FadeMode::IN);
|
||||
fade->activate();
|
||||
fade_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
||||
fade_->setType(FadeType::FULLSCREEN);
|
||||
fade_->setPost(param.fade.post_duration);
|
||||
fade_->setMode(FadeMode::IN);
|
||||
fade_->activate();
|
||||
|
||||
// Rellena la textura de texto
|
||||
fillTexture();
|
||||
@@ -69,187 +68,187 @@ Instructions::Instructions(JA_Music_t *music)
|
||||
// Destructor
|
||||
Instructions::~Instructions()
|
||||
{
|
||||
itemTextures.clear();
|
||||
sprites.clear();
|
||||
item_textures_.clear();
|
||||
sprites_.clear();
|
||||
|
||||
SDL_DestroyTexture(backbuffer);
|
||||
SDL_DestroyTexture(texture);
|
||||
SDL_DestroyTexture(backbuffer_);
|
||||
SDL_DestroyTexture(texture_);
|
||||
}
|
||||
|
||||
// Inicializa los sprites de los items
|
||||
void Instructions::iniSprites()
|
||||
{
|
||||
// Inicializa las texturas
|
||||
auto item1 = std::make_shared<Texture>(renderer, Asset::get()->get("item_points1_disk.png"));
|
||||
itemTextures.push_back(item1);
|
||||
auto item1 = std::make_shared<Texture>(renderer_, Asset::get()->get("item_points1_disk.png"));
|
||||
item_textures_.push_back(item1);
|
||||
|
||||
auto item2 = std::make_shared<Texture>(renderer, Asset::get()->get("item_points2_gavina.png"));
|
||||
itemTextures.push_back(item2);
|
||||
auto item2 = std::make_shared<Texture>(renderer_, Asset::get()->get("item_points2_gavina.png"));
|
||||
item_textures_.push_back(item2);
|
||||
|
||||
auto item3 = std::make_shared<Texture>(renderer, Asset::get()->get("item_points3_pacmar.png"));
|
||||
itemTextures.push_back(item3);
|
||||
auto item3 = std::make_shared<Texture>(renderer_, Asset::get()->get("item_points3_pacmar.png"));
|
||||
item_textures_.push_back(item3);
|
||||
|
||||
auto item4 = std::make_shared<Texture>(renderer, Asset::get()->get("item_clock.png"));
|
||||
itemTextures.push_back(item4);
|
||||
auto item4 = std::make_shared<Texture>(renderer_, Asset::get()->get("item_clock.png"));
|
||||
item_textures_.push_back(item4);
|
||||
|
||||
auto item5 = std::make_shared<Texture>(renderer, Asset::get()->get("item_coffee.png"));
|
||||
itemTextures.push_back(item5);
|
||||
auto item5 = std::make_shared<Texture>(renderer_, Asset::get()->get("item_coffee.png"));
|
||||
item_textures_.push_back(item5);
|
||||
|
||||
// Inicializa los sprites
|
||||
for (int i = 0; i < (int)itemTextures.size(); ++i)
|
||||
for (int i = 0; i < (int)item_textures_.size(); ++i)
|
||||
{
|
||||
auto sprite = std::make_unique<Sprite>(0, 0, param.game.item_size, param.game.item_size, itemTextures[i]);
|
||||
sprite->setPos((SDL_Point){spritePos.x, spritePos.y + ((param.game.item_size + itemSpace) * i)});
|
||||
sprites.push_back(std::move(sprite));
|
||||
auto sprite = std::make_unique<Sprite>(0, 0, param.game.item_size, param.game.item_size, item_textures_[i]);
|
||||
sprite->setPos((SDL_Point){sprite_pos_.x, sprite_pos_.y + ((param.game.item_size + item_space_) * i)});
|
||||
sprites_.push_back(std::move(sprite));
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza los sprites
|
||||
void Instructions::updateSprites()
|
||||
{
|
||||
SDL_Rect srcRect = {0, 0, param.game.item_size, param.game.item_size};
|
||||
SDL_Rect src_rect = {0, 0, param.game.item_size, param.game.item_size};
|
||||
|
||||
// Disquito
|
||||
srcRect.y = param.game.item_size * (((counter + 12) / 36) % 2);
|
||||
sprites[0]->setSpriteClip(srcRect);
|
||||
src_rect.y = param.game.item_size * (((counter_ + 12) / 36) % 2);
|
||||
sprites_[0]->setSpriteClip(src_rect);
|
||||
|
||||
// Gavineixon
|
||||
srcRect.y = param.game.item_size * (((counter + 9) / 36) % 2);
|
||||
sprites[1]->setSpriteClip(srcRect);
|
||||
// Gavina
|
||||
src_rect.y = param.game.item_size * (((counter_ + 9) / 36) % 2);
|
||||
sprites_[1]->setSpriteClip(src_rect);
|
||||
|
||||
// Pacmar
|
||||
srcRect.y = param.game.item_size * (((counter + 6) / 36) % 2);
|
||||
sprites[2]->setSpriteClip(srcRect);
|
||||
src_rect.y = param.game.item_size * (((counter_ + 6) / 36) % 2);
|
||||
sprites_[2]->setSpriteClip(src_rect);
|
||||
|
||||
// Time Stopper
|
||||
srcRect.y = param.game.item_size * (((counter + 3) / 36) % 2);
|
||||
sprites[3]->setSpriteClip(srcRect);
|
||||
src_rect.y = param.game.item_size * (((counter_ + 3) / 36) % 2);
|
||||
sprites_[3]->setSpriteClip(src_rect);
|
||||
|
||||
// Coffee
|
||||
srcRect.y = param.game.item_size * (((counter + 0) / 36) % 2);
|
||||
sprites[4]->setSpriteClip(srcRect);
|
||||
src_rect.y = param.game.item_size * (((counter_ + 0) / 36) % 2);
|
||||
sprites_[4]->setSpriteClip(src_rect);
|
||||
}
|
||||
|
||||
// Rellena la textura de texto
|
||||
void Instructions::fillTexture()
|
||||
{
|
||||
const int despX = param.game.item_size + 8;
|
||||
const int desp_x = param.game.item_size + 8;
|
||||
|
||||
// Modifica el renderizador para pintar en la textura
|
||||
SDL_Texture *temp = SDL_GetRenderTarget(renderer);
|
||||
SDL_SetRenderTarget(renderer, texture);
|
||||
auto temp = SDL_GetRenderTarget(renderer_);
|
||||
SDL_SetRenderTarget(renderer_, texture_);
|
||||
|
||||
// Limpia la textura
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_SetRenderDrawColor(renderer_, 0, 0, 0, 0);
|
||||
SDL_RenderClear(renderer_);
|
||||
|
||||
// Constantes
|
||||
const int numLines = 4;
|
||||
const int numItemLines = 4;
|
||||
const int numPostHeaders = 2;
|
||||
const int numPreHeaders = 1;
|
||||
constexpr int num_lines = 4;
|
||||
constexpr int num_item_lines = 4;
|
||||
constexpr int num_post_headers = 2;
|
||||
constexpr int num_pre_headers = 1;
|
||||
|
||||
const int spacePostHeader = 20;
|
||||
const int spacePreHeader = 28;
|
||||
const int spaceBetweenLines = text->getCharacterSize() * 1.5f;
|
||||
const int spaceBetweenItemLines = param.game.item_size + itemSpace;
|
||||
const int spaceNewParagraph = spaceBetweenLines * 0.5f;
|
||||
constexpr int space_post_header = 20;
|
||||
constexpr int space_pre_header = 28;
|
||||
const int space_between_lines = text_->getCharacterSize() * 1.5f;
|
||||
const int space_between_item_lines = param.game.item_size + item_space_;
|
||||
const int space_new_paragraph = space_between_lines * 0.5f;
|
||||
|
||||
const int size = (numLines * spaceBetweenLines) + (numItemLines * spaceBetweenItemLines) + (numPostHeaders * spacePostHeader) + (numPreHeaders * spacePreHeader) + (spaceNewParagraph);
|
||||
const int firstLine = (param.game.height - size) / 2;
|
||||
const int size = (num_lines * space_between_lines) + (num_item_lines * space_between_item_lines) + (num_post_headers * space_post_header) + (num_pre_headers * space_pre_header) + (space_new_paragraph);
|
||||
const int first_line = (param.game.height - size) / 2;
|
||||
|
||||
// Calcula cual es el texto más largo de las descripciones de los items
|
||||
int lenght = 0;
|
||||
for (int i = 17; i <= 21; ++i)
|
||||
{
|
||||
const int l = text->lenght(lang::getText(i));
|
||||
const int l = text_->lenght(lang::getText(i));
|
||||
lenght = l > lenght ? l : lenght;
|
||||
}
|
||||
const int anchorItem = (param.game.width - (lenght + despX)) / 2;
|
||||
const int anchor_item = (param.game.width - (lenght + desp_x)) / 2;
|
||||
|
||||
// Escribe el texto de las instrucciones
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, firstLine, lang::getText(11), 1, orange_color, 1, shdw_txt_color);
|
||||
text_->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, first_line, lang::getText(11), 1, orange_color, 1, shdw_txt_color);
|
||||
|
||||
const int anchor1 = firstLine + spacePostHeader;
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceBetweenLines * 0, lang::getText(12), 1, no_color, 1, shdw_txt_color);
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceBetweenLines * 1, lang::getText(13), 1, no_color, 1, shdw_txt_color);
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceNewParagraph + spaceBetweenLines * 2, lang::getText(14), 1, no_color, 1, shdw_txt_color);
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceNewParagraph + spaceBetweenLines * 3, lang::getText(15), 1, no_color, 1, shdw_txt_color);
|
||||
const int anchor1 = first_line + space_post_header;
|
||||
text_->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + space_between_lines * 0, lang::getText(12), 1, no_color, 1, shdw_txt_color);
|
||||
text_->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + space_between_lines * 1, lang::getText(13), 1, no_color, 1, shdw_txt_color);
|
||||
text_->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + space_new_paragraph + space_between_lines * 2, lang::getText(14), 1, no_color, 1, shdw_txt_color);
|
||||
text_->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor1 + space_new_paragraph + space_between_lines * 3, lang::getText(15), 1, no_color, 1, shdw_txt_color);
|
||||
|
||||
// Escribe el texto de los objetos y sus puntos
|
||||
const int anchor2 = anchor1 + spacePreHeader + spaceNewParagraph + spaceBetweenLines * 3;
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor2, lang::getText(16), 1, orange_color, 1, shdw_txt_color);
|
||||
const int anchor2 = anchor1 + space_pre_header + space_new_paragraph + space_between_lines * 3;
|
||||
text_->writeDX(TEXT_CENTER | TEXT_COLOR | TEXT_SHADOW, param.game.game_area.center_x, anchor2, lang::getText(16), 1, orange_color, 1, shdw_txt_color);
|
||||
|
||||
const int anchor3 = anchor2 + spacePostHeader;
|
||||
const int anchor3 = anchor2 + space_post_header;
|
||||
// const int anchor4 = anchor3 + ((param.game.item_size + text->getCharacterSize()) / 2);
|
||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 0, lang::getText(17), shdw_txt_color);
|
||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 1, lang::getText(18), shdw_txt_color);
|
||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 2, lang::getText(19), shdw_txt_color);
|
||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 3, lang::getText(20), shdw_txt_color);
|
||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 4, lang::getText(21), shdw_txt_color);
|
||||
text_->writeShadowed(anchor_item + desp_x, anchor3 + space_between_item_lines * 0, lang::getText(17), shdw_txt_color);
|
||||
text_->writeShadowed(anchor_item + desp_x, anchor3 + space_between_item_lines * 1, lang::getText(18), shdw_txt_color);
|
||||
text_->writeShadowed(anchor_item + desp_x, anchor3 + space_between_item_lines * 2, lang::getText(19), shdw_txt_color);
|
||||
text_->writeShadowed(anchor_item + desp_x, anchor3 + space_between_item_lines * 3, lang::getText(20), shdw_txt_color);
|
||||
text_->writeShadowed(anchor_item + desp_x, anchor3 + space_between_item_lines * 4, lang::getText(21), shdw_txt_color);
|
||||
|
||||
// Deja el renderizador como estaba
|
||||
SDL_SetRenderTarget(renderer, temp);
|
||||
SDL_SetRenderTarget(renderer_, temp);
|
||||
|
||||
// Da valor a la variable
|
||||
spritePos.x = anchorItem;
|
||||
spritePos.y = anchor3 - ((param.game.item_size - text->getCharacterSize()) / 2);
|
||||
sprite_pos_.x = anchor_item;
|
||||
sprite_pos_.y = anchor3 - ((param.game.item_size - text_->getCharacterSize()) / 2);
|
||||
}
|
||||
|
||||
// Rellena el backbuffer
|
||||
void Instructions::fillBackbuffer()
|
||||
{
|
||||
// Modifica el renderizador para pintar en la textura
|
||||
SDL_Texture *temp = SDL_GetRenderTarget(renderer);
|
||||
SDL_SetRenderTarget(renderer, backbuffer);
|
||||
auto temp = SDL_GetRenderTarget(renderer_);
|
||||
SDL_SetRenderTarget(renderer_, backbuffer_);
|
||||
|
||||
// Limpia la textura
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_SetRenderDrawColor(renderer_, 0, 0, 0, 0);
|
||||
SDL_RenderClear(renderer_);
|
||||
|
||||
// Coloca el texto de fondo
|
||||
SDL_RenderCopy(renderer, texture, nullptr, nullptr);
|
||||
SDL_RenderCopy(renderer_, texture_, nullptr, nullptr);
|
||||
|
||||
// Dibuja los sprites
|
||||
for (auto &sprite : sprites)
|
||||
for (auto &sprite : sprites_)
|
||||
{
|
||||
sprite->render();
|
||||
}
|
||||
|
||||
// Deja el renderizador como estaba
|
||||
SDL_SetRenderTarget(renderer, temp);
|
||||
SDL_SetRenderTarget(renderer_, temp);
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
void Instructions::update()
|
||||
{
|
||||
// Actualiza las variables
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
if (SDL_GetTicks() - ticks_ > ticks_speed_)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
ticks_ = SDL_GetTicks();
|
||||
|
||||
// Mantiene la música sonando
|
||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||
JA_PlayMusic(music);
|
||||
JA_PlayMusic(music_);
|
||||
|
||||
// Actualiza el objeto screen
|
||||
Screen::get()->update();
|
||||
|
||||
// Incrementa el contador
|
||||
counter++;
|
||||
counter_++;
|
||||
|
||||
// Actualiza los sprites
|
||||
updateSprites();
|
||||
|
||||
// Actualiza el mosaico de fondo
|
||||
tiledbg->update();
|
||||
tiled_bg_->update();
|
||||
|
||||
// Actualiza el objeto "fade"
|
||||
fade->update();
|
||||
fade_->update();
|
||||
|
||||
// Comprueba si el contador ha llegado al final
|
||||
if (counter == counterEnd)
|
||||
if (counter_ == counter_end_)
|
||||
{
|
||||
section::name = section::Name::TITLE;
|
||||
section::options = section::Options::TITLE_1;
|
||||
@@ -270,15 +269,15 @@ void Instructions::render()
|
||||
Screen::get()->clean(bg_color);
|
||||
|
||||
// Dibuja el mosacico de fondo
|
||||
tiledbg->render();
|
||||
tiled_bg_->render();
|
||||
|
||||
// Establece la ventana del backbuffer
|
||||
view.y = std::max(0, param.game.height - counter + 100);
|
||||
view_.y = std::max(0, param.game.height - counter_ + 100);
|
||||
|
||||
// Copia la textura y el backbuffer al renderizador
|
||||
SDL_RenderCopy(renderer, backbuffer, nullptr, &view);
|
||||
SDL_RenderCopy(renderer_, backbuffer_, nullptr, &view_);
|
||||
|
||||
fade->render();
|
||||
fade_->render();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
Screen::get()->blit();
|
||||
@@ -287,11 +286,11 @@ void Instructions::render()
|
||||
// Recarga todas las texturas
|
||||
void Instructions::reloadTextures()
|
||||
{
|
||||
for (auto &tex : itemTextures)
|
||||
for (auto &texture : item_textures_)
|
||||
{
|
||||
tex->reLoad();
|
||||
texture->reLoad();
|
||||
}
|
||||
text->reLoadTexture();
|
||||
text_->reLoadTexture();
|
||||
fillTexture();
|
||||
}
|
||||
|
||||
@@ -299,19 +298,20 @@ void Instructions::reloadTextures()
|
||||
void Instructions::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler.get()) != 0)
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
if (event.type == SDL_QUIT)
|
||||
{
|
||||
section::name = section::Name::QUIT;
|
||||
break;
|
||||
}
|
||||
|
||||
// Comprueba si se ha cambiado el tamaño de la ventana
|
||||
else if (eventHandler->type == SDL_WINDOWEVENT)
|
||||
else if (event.type == SDL_WINDOWEVENT)
|
||||
{
|
||||
if (eventHandler->window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||
{
|
||||
reloadTextures();
|
||||
}
|
||||
|
||||
@@ -31,26 +31,25 @@ class Instructions
|
||||
{
|
||||
private:
|
||||
// Objetos y punteros
|
||||
std::vector<std::shared_ptr<Texture>> itemTextures; // Vector con las texturas de los items
|
||||
std::vector<std::unique_ptr<Sprite>> sprites; // Vector con los sprites de los items
|
||||
std::unique_ptr<SDL_Event> eventHandler; // Manejador de eventos
|
||||
std::unique_ptr<Text> text; // Objeto para escribir texto
|
||||
std::unique_ptr<Tiledbg> tiledbg; // Objeto para dibujar el mosaico animado de fondo
|
||||
std::unique_ptr<Fade> fade; // Objeto para renderizar fades
|
||||
std::vector<std::shared_ptr<Texture>> item_textures_; // Vector con las texturas de los items
|
||||
std::vector<std::unique_ptr<Sprite>> sprites_; // Vector con los sprites de los items
|
||||
std::unique_ptr<Text> text_; // Objeto para escribir texto
|
||||
std::unique_ptr<Tiledbg> tiled_bg_; // Objeto para dibujar el mosaico animado de fondo
|
||||
std::unique_ptr<Fade> fade_; // Objeto para renderizar fades
|
||||
|
||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||
JA_Music_t *music; // Musica de fondo
|
||||
SDL_Texture *texture; // Textura fija con el texto
|
||||
SDL_Texture *backbuffer; // Textura para usar como backbuffer
|
||||
SDL_Renderer *renderer_; // El renderizador de la ventana
|
||||
JA_Music_t *music_; // Musica de fondo
|
||||
SDL_Texture *texture_; // Textura fija con el texto
|
||||
SDL_Texture *backbuffer_; // Textura para usar como backbuffer
|
||||
|
||||
// Variables
|
||||
int counter; // Contador
|
||||
int counterEnd; // Valor final para el contador
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
SDL_Rect view; // Vista del backbuffer que se va amostrar por pantalla
|
||||
SDL_Point spritePos; // Posición del primer sprite
|
||||
int itemSpace; // Espacio entre los items
|
||||
int counter_; // Contador
|
||||
int counter_end_; // Valor final para el contador
|
||||
Uint32 ticks_; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticks_speed_; // Velocidad a la que se repiten los bucles del programa
|
||||
SDL_Rect view_; // Vista del backbuffer que se va amostrar por pantalla
|
||||
SDL_Point sprite_pos_; // Posición del primer sprite
|
||||
int item_space_; // Espacio entre los items
|
||||
|
||||
// Actualiza las variables
|
||||
void update();
|
||||
|
||||
289
source/intro.cpp
289
source/intro.cpp
@@ -20,134 +20,134 @@ struct JA_Music_t;
|
||||
|
||||
// Constructor
|
||||
Intro::Intro(JA_Music_t *music)
|
||||
: music(music)
|
||||
: music_(music)
|
||||
{
|
||||
// Copia los punteros
|
||||
auto renderer = Screen::get()->getRenderer();
|
||||
|
||||
// Reserva memoria para los objetos
|
||||
texture = std::make_shared<Texture>(renderer, Asset::get()->get("intro.png"));
|
||||
text = std::make_shared<Text>(Asset::get()->get("nokia.png"), Asset::get()->get("nokia.txt"), renderer);
|
||||
texture_ = std::make_shared<Texture>(renderer, Asset::get()->get("intro.png"));
|
||||
text_ = std::make_shared<Text>(Asset::get()->get("nokia.png"), Asset::get()->get("nokia.txt"), renderer);
|
||||
|
||||
// Inicializa variables
|
||||
section::name = section::Name::INTRO;
|
||||
section::options = section::Options::NONE;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
scene = 1;
|
||||
ticks_ = 0;
|
||||
ticks_speed_ = 15;
|
||||
scene_ = 1;
|
||||
|
||||
// Inicializa los bitmaps de la intro
|
||||
constexpr int totalBitmaps = 6;
|
||||
for (int i = 0; i < totalBitmaps; ++i)
|
||||
{
|
||||
auto ss = std::make_unique<SmartSprite>(texture);
|
||||
auto ss = std::make_unique<SmartSprite>(texture_);
|
||||
ss->setWidth(128);
|
||||
ss->setHeight(96);
|
||||
ss->setFinishedCounter(20);
|
||||
ss->setDestX(param.game.game_area.center_x - 64);
|
||||
ss->setDestY(param.game.game_area.first_quarter_y - 24);
|
||||
bitmaps.push_back(std::move(ss));
|
||||
bitmaps_.push_back(std::move(ss));
|
||||
}
|
||||
|
||||
bitmaps[0]->setPosX(-128);
|
||||
bitmaps[0]->setPosY(param.game.game_area.first_quarter_y - 24);
|
||||
bitmaps[0]->setVelX(0.0f);
|
||||
bitmaps[0]->setVelY(0.0f);
|
||||
bitmaps[0]->setAccelX(0.6f);
|
||||
bitmaps[0]->setAccelY(0.0f);
|
||||
bitmaps[0]->setSpriteClip(0, 0, 128, 96);
|
||||
bitmaps_[0]->setPosX(-128);
|
||||
bitmaps_[0]->setPosY(param.game.game_area.first_quarter_y - 24);
|
||||
bitmaps_[0]->setVelX(0.0f);
|
||||
bitmaps_[0]->setVelY(0.0f);
|
||||
bitmaps_[0]->setAccelX(0.6f);
|
||||
bitmaps_[0]->setAccelY(0.0f);
|
||||
bitmaps_[0]->setSpriteClip(0, 0, 128, 96);
|
||||
|
||||
bitmaps[1]->setPosX(param.game.width);
|
||||
bitmaps[1]->setPosY(param.game.game_area.first_quarter_y - 24);
|
||||
bitmaps[1]->setVelX(-1.0f);
|
||||
bitmaps[1]->setVelY(0.0f);
|
||||
bitmaps[1]->setAccelX(-0.3f);
|
||||
bitmaps[1]->setAccelY(0.0f);
|
||||
bitmaps[1]->setSpriteClip(128, 0, 128, 96);
|
||||
bitmaps_[1]->setPosX(param.game.width);
|
||||
bitmaps_[1]->setPosY(param.game.game_area.first_quarter_y - 24);
|
||||
bitmaps_[1]->setVelX(-1.0f);
|
||||
bitmaps_[1]->setVelY(0.0f);
|
||||
bitmaps_[1]->setAccelX(-0.3f);
|
||||
bitmaps_[1]->setAccelY(0.0f);
|
||||
bitmaps_[1]->setSpriteClip(128, 0, 128, 96);
|
||||
|
||||
bitmaps[2]->setPosX(param.game.game_area.center_x - 64);
|
||||
bitmaps[2]->setPosY(-96);
|
||||
bitmaps[2]->setVelX(0.0f);
|
||||
bitmaps[2]->setVelY(3.0f);
|
||||
bitmaps[2]->setAccelX(0.1f);
|
||||
bitmaps[2]->setAccelY(0.3f);
|
||||
bitmaps[2]->setSpriteClip(0, 96, 128, 96);
|
||||
bitmaps[2]->setFinishedCounter(250);
|
||||
bitmaps_[2]->setPosX(param.game.game_area.center_x - 64);
|
||||
bitmaps_[2]->setPosY(-96);
|
||||
bitmaps_[2]->setVelX(0.0f);
|
||||
bitmaps_[2]->setVelY(3.0f);
|
||||
bitmaps_[2]->setAccelX(0.1f);
|
||||
bitmaps_[2]->setAccelY(0.3f);
|
||||
bitmaps_[2]->setSpriteClip(0, 96, 128, 96);
|
||||
bitmaps_[2]->setFinishedCounter(250);
|
||||
|
||||
bitmaps[3]->setPosX(param.game.game_area.center_x - 64);
|
||||
bitmaps[3]->setPosY(param.game.height);
|
||||
bitmaps[3]->setVelX(0.0f);
|
||||
bitmaps[3]->setVelY(-0.7f);
|
||||
bitmaps[3]->setAccelX(0.0f);
|
||||
bitmaps[3]->setAccelY(0.0f);
|
||||
bitmaps[3]->setSpriteClip(128, 96, 128, 96);
|
||||
bitmaps_[3]->setPosX(param.game.game_area.center_x - 64);
|
||||
bitmaps_[3]->setPosY(param.game.height);
|
||||
bitmaps_[3]->setVelX(0.0f);
|
||||
bitmaps_[3]->setVelY(-0.7f);
|
||||
bitmaps_[3]->setAccelX(0.0f);
|
||||
bitmaps_[3]->setAccelY(0.0f);
|
||||
bitmaps_[3]->setSpriteClip(128, 96, 128, 96);
|
||||
|
||||
bitmaps[4]->setPosX(param.game.game_area.center_x - 64);
|
||||
bitmaps[4]->setPosY(-96);
|
||||
bitmaps[4]->setVelX(0.0f);
|
||||
bitmaps[4]->setVelY(3.0f);
|
||||
bitmaps[4]->setAccelX(0.1f);
|
||||
bitmaps[4]->setAccelY(0.3f);
|
||||
bitmaps[4]->setSpriteClip(0, 192, 128, 96);
|
||||
bitmaps_[4]->setPosX(param.game.game_area.center_x - 64);
|
||||
bitmaps_[4]->setPosY(-96);
|
||||
bitmaps_[4]->setVelX(0.0f);
|
||||
bitmaps_[4]->setVelY(3.0f);
|
||||
bitmaps_[4]->setAccelX(0.1f);
|
||||
bitmaps_[4]->setAccelY(0.3f);
|
||||
bitmaps_[4]->setSpriteClip(0, 192, 128, 96);
|
||||
|
||||
bitmaps[5]->setPosX(param.game.width);
|
||||
bitmaps[5]->setPosY(param.game.game_area.first_quarter_y - 24);
|
||||
bitmaps[5]->setVelX(-0.7f);
|
||||
bitmaps[5]->setVelY(0.0f);
|
||||
bitmaps[5]->setAccelX(0.0f);
|
||||
bitmaps[5]->setAccelY(0.0f);
|
||||
bitmaps[5]->setSpriteClip(128, 192, 128, 96);
|
||||
bitmaps_[5]->setPosX(param.game.width);
|
||||
bitmaps_[5]->setPosY(param.game.game_area.first_quarter_y - 24);
|
||||
bitmaps_[5]->setVelX(-0.7f);
|
||||
bitmaps_[5]->setVelY(0.0f);
|
||||
bitmaps_[5]->setAccelX(0.0f);
|
||||
bitmaps_[5]->setAccelY(0.0f);
|
||||
bitmaps_[5]->setSpriteClip(128, 192, 128, 96);
|
||||
|
||||
// Inicializa los textos de la intro
|
||||
constexpr int totalTexts = 9;
|
||||
for (int i = 0; i < totalTexts; ++i)
|
||||
{
|
||||
auto w = std::make_unique<Writer>(text);
|
||||
auto w = std::make_unique<Writer>(text_);
|
||||
w->setPosX(BLOCK * 0);
|
||||
w->setPosY(param.game.height - (BLOCK * 6));
|
||||
w->setKerning(-1);
|
||||
w->setEnabled(false);
|
||||
w->setFinishedCounter(180);
|
||||
texts.push_back(std::move(w));
|
||||
texts_.push_back(std::move(w));
|
||||
}
|
||||
|
||||
// Un dia qualsevol de l'any 2000
|
||||
texts[0]->setCaption(lang::getText(27));
|
||||
texts[0]->setSpeed(8);
|
||||
texts_[0]->setCaption(lang::getText(27));
|
||||
texts_[0]->setSpeed(8);
|
||||
|
||||
// Tot esta tranquil a la UPV
|
||||
texts[1]->setCaption(lang::getText(28));
|
||||
texts[1]->setSpeed(8);
|
||||
texts_[1]->setCaption(lang::getText(28));
|
||||
texts_[1]->setSpeed(8);
|
||||
|
||||
// Fins que un desaprensiu...
|
||||
texts[2]->setCaption(lang::getText(29));
|
||||
texts[2]->setSpeed(12);
|
||||
texts_[2]->setCaption(lang::getText(29));
|
||||
texts_[2]->setSpeed(12);
|
||||
|
||||
// HEY! ME ANE A FERME UN CORTAET...
|
||||
texts[3]->setCaption(lang::getText(30));
|
||||
texts[3]->setSpeed(8);
|
||||
texts_[3]->setCaption(lang::getText(30));
|
||||
texts_[3]->setSpeed(8);
|
||||
|
||||
// UAAAAAAAAAAAAA!!!
|
||||
texts[4]->setCaption(lang::getText(31));
|
||||
texts[4]->setSpeed(1);
|
||||
texts_[4]->setCaption(lang::getText(31));
|
||||
texts_[4]->setSpeed(1);
|
||||
|
||||
// Espera un moment...
|
||||
texts[5]->setCaption(lang::getText(32));
|
||||
texts[5]->setSpeed(16);
|
||||
texts_[5]->setCaption(lang::getText(32));
|
||||
texts_[5]->setSpeed(16);
|
||||
|
||||
// Si resulta que no tinc solt!
|
||||
texts[6]->setCaption(lang::getText(33));
|
||||
texts[6]->setSpeed(2);
|
||||
texts_[6]->setCaption(lang::getText(33));
|
||||
texts_[6]->setSpeed(2);
|
||||
|
||||
// MERDA DE MAQUINA!
|
||||
texts[7]->setCaption(lang::getText(34));
|
||||
texts[7]->setSpeed(3);
|
||||
texts_[7]->setCaption(lang::getText(34));
|
||||
texts_[7]->setSpeed(3);
|
||||
|
||||
// Blop... blop... blop...
|
||||
texts[8]->setCaption(lang::getText(35));
|
||||
texts[8]->setSpeed(16);
|
||||
texts_[8]->setCaption(lang::getText(35));
|
||||
texts_[8]->setSpeed(16);
|
||||
|
||||
for (auto &text : texts)
|
||||
for (auto &text : texts_)
|
||||
{
|
||||
text->center(param.game.game_area.center_x);
|
||||
}
|
||||
@@ -156,8 +156,8 @@ Intro::Intro(JA_Music_t *music)
|
||||
// Recarga todas las texturas
|
||||
void Intro::reloadTextures()
|
||||
{
|
||||
texture->reLoad();
|
||||
text->reLoadTexture();
|
||||
texture_->reLoad();
|
||||
text_->reLoadTexture();
|
||||
}
|
||||
|
||||
// Comprueba los eventos
|
||||
@@ -213,153 +213,158 @@ void Intro::checkInput()
|
||||
// Actualiza las escenas de la intro
|
||||
void Intro::updateScenes()
|
||||
{
|
||||
switch (scene)
|
||||
switch (scene_)
|
||||
{
|
||||
case 1:
|
||||
// Primera imagen - UPV
|
||||
if (!bitmaps[0]->hasFinished())
|
||||
{ // Primera imagen - UPV
|
||||
if (!bitmaps_[0]->hasFinished())
|
||||
{
|
||||
bitmaps[0]->setEnabled(true);
|
||||
bitmaps_[0]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Primer texto de la primera imagen
|
||||
if (bitmaps[0]->hasFinished() && !texts[0]->hasFinished())
|
||||
if (bitmaps_[0]->hasFinished() && !texts_[0]->hasFinished())
|
||||
{
|
||||
texts[0]->setEnabled(true);
|
||||
texts_[0]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Segundo texto de la primera imagen
|
||||
if (texts[0]->hasFinished() && !texts[1]->hasFinished())
|
||||
if (texts_[0]->hasFinished() && !texts_[1]->hasFinished())
|
||||
{
|
||||
texts[0]->setEnabled(false);
|
||||
texts[1]->setEnabled(true);
|
||||
texts_[0]->setEnabled(false);
|
||||
texts_[1]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Tercer texto de la primera imagen
|
||||
if (texts[1]->hasFinished() && !texts[2]->hasFinished())
|
||||
if (texts_[1]->hasFinished() && !texts_[2]->hasFinished())
|
||||
{
|
||||
texts[1]->setEnabled(false);
|
||||
texts[2]->setEnabled(true);
|
||||
texts_[1]->setEnabled(false);
|
||||
texts_[2]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Fin de la primera escena
|
||||
if (texts[2]->hasFinished())
|
||||
if (texts_[2]->hasFinished())
|
||||
{
|
||||
bitmaps[0]->setEnabled(false);
|
||||
texts[2]->setEnabled(false);
|
||||
scene++;
|
||||
bitmaps_[0]->setEnabled(false);
|
||||
texts_[2]->setEnabled(false);
|
||||
scene_++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
// Segunda imagen - Máquina
|
||||
if (!bitmaps[1]->hasFinished())
|
||||
{ // Segunda imagen - Máquina
|
||||
if (!bitmaps_[1]->hasFinished())
|
||||
{
|
||||
bitmaps[1]->setEnabled(true);
|
||||
bitmaps_[1]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Primer texto de la segunda imagen
|
||||
if (bitmaps[1]->hasFinished() && !texts[3]->hasFinished())
|
||||
if (bitmaps_[1]->hasFinished() && !texts_[3]->hasFinished())
|
||||
{
|
||||
texts[3]->setEnabled(true);
|
||||
texts_[3]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Fin de la segunda escena
|
||||
if (texts[3]->hasFinished())
|
||||
if (texts_[3]->hasFinished())
|
||||
{
|
||||
bitmaps[1]->setEnabled(false);
|
||||
texts[3]->setEnabled(false);
|
||||
scene++;
|
||||
bitmaps_[1]->setEnabled(false);
|
||||
texts_[3]->setEnabled(false);
|
||||
scene_++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case 3:
|
||||
// Tercera imagen junto con primer texto - GRITO
|
||||
if (!bitmaps[2]->hasFinished() && !texts[4]->hasFinished())
|
||||
{ // Tercera imagen junto con primer texto - GRITO
|
||||
if (!bitmaps_[2]->hasFinished() && !texts_[4]->hasFinished())
|
||||
{
|
||||
bitmaps[2]->setEnabled(true);
|
||||
texts[4]->setEnabled(true);
|
||||
bitmaps_[2]->setEnabled(true);
|
||||
texts_[4]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Fin de la tercera escena
|
||||
if (bitmaps[2]->hasFinished() && texts[4]->hasFinished())
|
||||
if (bitmaps_[2]->hasFinished() && texts_[4]->hasFinished())
|
||||
{
|
||||
bitmaps[2]->setEnabled(false);
|
||||
texts[4]->setEnabled(false);
|
||||
scene++;
|
||||
bitmaps_[2]->setEnabled(false);
|
||||
texts_[4]->setEnabled(false);
|
||||
scene_++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
// Cuarta imagen junto con primer texto - Reflexión
|
||||
if (!bitmaps[3]->hasFinished() && !texts[5]->hasFinished())
|
||||
{ // Cuarta imagen junto con primer texto - Reflexión
|
||||
if (!bitmaps_[3]->hasFinished() && !texts_[5]->hasFinished())
|
||||
{
|
||||
bitmaps[3]->setEnabled(true);
|
||||
texts[5]->setEnabled(true);
|
||||
bitmaps_[3]->setEnabled(true);
|
||||
texts_[5]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Segundo texto de la cuarta imagen
|
||||
if (texts[5]->hasFinished() && !texts[6]->hasFinished())
|
||||
if (texts_[5]->hasFinished() && !texts_[6]->hasFinished())
|
||||
{
|
||||
texts[5]->setEnabled(false);
|
||||
texts[6]->setEnabled(true);
|
||||
texts_[5]->setEnabled(false);
|
||||
texts_[6]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Fin de la cuarta escena
|
||||
if (bitmaps[3]->hasFinished() && texts[6]->hasFinished())
|
||||
if (bitmaps_[3]->hasFinished() && texts_[6]->hasFinished())
|
||||
{
|
||||
bitmaps[3]->setEnabled(false);
|
||||
texts[6]->setEnabled(false);
|
||||
scene++;
|
||||
bitmaps_[3]->setEnabled(false);
|
||||
texts_[6]->setEnabled(false);
|
||||
scene_++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
// Quinta imagen - Patada
|
||||
if (!bitmaps[4]->hasFinished())
|
||||
{ // Quinta imagen - Patada
|
||||
if (!bitmaps_[4]->hasFinished())
|
||||
{
|
||||
bitmaps[4]->setEnabled(true);
|
||||
bitmaps_[4]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Primer texto de la quinta imagen
|
||||
if (bitmaps[4]->hasFinished() && !texts[7]->hasFinished())
|
||||
if (bitmaps_[4]->hasFinished() && !texts_[7]->hasFinished())
|
||||
{
|
||||
texts[7]->setEnabled(true);
|
||||
texts_[7]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Fin de la quinta escena
|
||||
if (bitmaps[4]->hasFinished() && texts[7]->hasFinished())
|
||||
if (bitmaps_[4]->hasFinished() && texts_[7]->hasFinished())
|
||||
{
|
||||
bitmaps[4]->setEnabled(false);
|
||||
texts[7]->setEnabled(false);
|
||||
scene++;
|
||||
bitmaps_[4]->setEnabled(false);
|
||||
texts_[7]->setEnabled(false);
|
||||
scene_++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 6:
|
||||
// Sexta imagen junto con texto - Globos de café
|
||||
if (!bitmaps[5]->hasFinished() && !texts[8]->hasFinished())
|
||||
{ // Sexta imagen junto con texto - Globos de café
|
||||
if (!bitmaps_[5]->hasFinished() && !texts_[8]->hasFinished())
|
||||
{
|
||||
bitmaps[5]->setEnabled(true);
|
||||
texts[8]->setEnabled(true);
|
||||
bitmaps_[5]->setEnabled(true);
|
||||
texts_[8]->setEnabled(true);
|
||||
}
|
||||
|
||||
// Acaba el último texto
|
||||
if (bitmaps[5]->hasFinished() && texts[8]->hasFinished())
|
||||
if (bitmaps_[5]->hasFinished() && texts_[8]->hasFinished())
|
||||
{
|
||||
bitmaps[5]->setEnabled(false);
|
||||
texts[8]->setEnabled(false);
|
||||
bitmaps_[5]->setEnabled(false);
|
||||
texts_[8]->setEnabled(false);
|
||||
JA_StopMusic();
|
||||
section::name = section::Name::TITLE;
|
||||
section::options = section::Options::TITLE_1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -369,21 +374,21 @@ void Intro::updateScenes()
|
||||
// Actualiza las variables del objeto
|
||||
void Intro::update()
|
||||
{
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
if (SDL_GetTicks() - ticks_ > ticks_speed_)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
ticks_ = SDL_GetTicks();
|
||||
|
||||
// Actualiza el objeto screen
|
||||
Screen::get()->update();
|
||||
|
||||
// Actualiza los objetos
|
||||
for (auto &bitmap : bitmaps)
|
||||
for (auto &bitmap : bitmaps_)
|
||||
{
|
||||
bitmap->update();
|
||||
}
|
||||
|
||||
for (auto &text : texts)
|
||||
for (auto &text : texts_)
|
||||
{
|
||||
text->update();
|
||||
}
|
||||
@@ -403,12 +408,12 @@ void Intro::render()
|
||||
Screen::get()->clean(bg_color);
|
||||
|
||||
// Dibuja los objetos
|
||||
for (auto &bitmap : bitmaps)
|
||||
for (auto &bitmap : bitmaps_)
|
||||
{
|
||||
bitmap->render();
|
||||
}
|
||||
|
||||
for (auto &text : texts)
|
||||
for (auto &text : texts_)
|
||||
{
|
||||
text->render();
|
||||
}
|
||||
@@ -420,7 +425,7 @@ void Intro::render()
|
||||
// Bucle principal
|
||||
void Intro::run()
|
||||
{
|
||||
JA_PlayMusic(music, 0);
|
||||
JA_PlayMusic(music_, 0);
|
||||
|
||||
while (section::name == section::Name::INTRO)
|
||||
{
|
||||
|
||||
@@ -20,17 +20,17 @@ class Intro
|
||||
{
|
||||
private:
|
||||
// Objetos
|
||||
std::shared_ptr<Texture> texture; // Textura con los graficos
|
||||
std::shared_ptr<Text> text; // Textos de la intro
|
||||
std::shared_ptr<Texture> texture_; // Textura con los graficos
|
||||
std::shared_ptr<Text> text_; // Textos de la intro
|
||||
|
||||
std::vector<std::unique_ptr<SmartSprite>> bitmaps; // Vector con los sprites inteligentes para los dibujos de la intro
|
||||
std::vector<std::unique_ptr<Writer>> texts; // Textos de la intro
|
||||
std::vector<std::unique_ptr<SmartSprite>> bitmaps_; // Vector con los sprites inteligentes para los dibujos de la intro
|
||||
std::vector<std::unique_ptr<Writer>> texts_; // Textos de la intro
|
||||
|
||||
// Variables
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint8 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
JA_Music_t *music; // Musica para la intro
|
||||
int scene; // Indica que escena está activa
|
||||
Uint32 ticks_; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint8 ticks_speed_; // Velocidad a la que se repiten los bucles del programa
|
||||
JA_Music_t *music_; // Musica para la intro
|
||||
int scene_; // Indica que escena está activa
|
||||
|
||||
// Actualiza las variables del objeto
|
||||
void update();
|
||||
|
||||
Reference in New Issue
Block a user