Continuemtreballant enels credits
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <SDL2/SDL_rect.h> // Para SDL_Rect
|
||||||
#include <SDL2/SDL_stdinc.h> // Para Uint8, Uint16, Uint32
|
#include <SDL2/SDL_stdinc.h> // Para Uint8, Uint16, Uint32
|
||||||
#include <memory> // Para shared_ptr, unique_ptr
|
#include <memory> // Para shared_ptr, unique_ptr
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
#include "animated_sprite.h" // Para AnimatedSprite
|
#include "animated_sprite.h" // Para AnimatedSprite
|
||||||
#include "utils.h" // Para Circle
|
#include "utils.h" // Para Circle
|
||||||
class Texture; // lines 10-10
|
class Texture; // lines 9-9
|
||||||
|
|
||||||
// Cantidad de elementos del vector con los valores de la deformación del globo al rebotar
|
// Cantidad de elementos del vector con los valores de la deformación del globo al rebotar
|
||||||
constexpr int MAX_BOUNCE = 10;
|
constexpr int MAX_BOUNCE = 10;
|
||||||
|
|||||||
@@ -119,6 +119,17 @@ void BalloonManager::deployBalloonFormation(int stage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BalloonManager::deployBalloonFormation(int pool, int set_number)
|
||||||
|
{
|
||||||
|
const auto set = balloon_formations_->getSet(pool, set_number);
|
||||||
|
const auto numEnemies = set.number_of_balloons;
|
||||||
|
for (int i = 0; i < numEnemies; ++i)
|
||||||
|
{
|
||||||
|
auto p = set.init[i];
|
||||||
|
createBalloon(p.x, p.y, p.type, p.size, p.vel_x, balloon_speed_, p.creation_counter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Vacia del vector de globos los globos que ya no sirven
|
// Vacia del vector de globos los globos que ya no sirven
|
||||||
void BalloonManager::freeBalloons()
|
void BalloonManager::freeBalloons()
|
||||||
{
|
{
|
||||||
@@ -339,13 +350,7 @@ void BalloonManager::reLoad()
|
|||||||
// Crea dos globos gordos
|
// Crea dos globos gordos
|
||||||
void BalloonManager::createTwoBigBalloons()
|
void BalloonManager::createTwoBigBalloons()
|
||||||
{
|
{
|
||||||
const auto set = balloon_formations_->getSet(0, 1);
|
deployBalloonFormation(0, 1);
|
||||||
const auto numEnemies = set.number_of_balloons;
|
|
||||||
for (int i = 0; i < numEnemies; ++i)
|
|
||||||
{
|
|
||||||
auto p = set.init[i];
|
|
||||||
createBalloon(p.x, p.y, p.type, p.size, p.vel_x, balloon_speed_, p.creation_counter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el nivel de ameza actual generado por los globos
|
// Obtiene el nivel de ameza actual generado por los globos
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <SDL2/SDL_rect.h> // Para SDL_Rect
|
||||||
#include <memory> // Para shared_ptr, unique_ptr
|
#include <memory> // Para shared_ptr, unique_ptr
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
#include "balloon.h" // Para BALLOON_SPEED, Balloon
|
#include "balloon.h" // Para BALLOON_SPEED, Balloon
|
||||||
#include "balloon_formations.h" // Para BalloonFormations
|
#include "balloon_formations.h" // Para BalloonFormations
|
||||||
#include "explosions.h" // Para Explosions
|
#include "explosions.h" // Para Explosions
|
||||||
#include "param.h"
|
#include "param.h" // Para Param, ParamGame, param
|
||||||
class Texture;
|
#include "utils.h" // Para Zone
|
||||||
|
class Texture; // lines 10-10
|
||||||
|
|
||||||
using Balloons = std::vector<std::shared_ptr<Balloon>>;
|
using Balloons = std::vector<std::shared_ptr<Balloon>>;
|
||||||
|
|
||||||
@@ -53,6 +55,7 @@ public:
|
|||||||
|
|
||||||
// Crea una formación de enemigos
|
// Crea una formación de enemigos
|
||||||
void deployBalloonFormation(int stage);
|
void deployBalloonFormation(int stage);
|
||||||
|
void deployBalloonFormation(int pool, int set);
|
||||||
|
|
||||||
// Actualiza la variable enemyDeployCounter
|
// Actualiza la variable enemyDeployCounter
|
||||||
void updateBalloonDeployCounter();
|
void updateBalloonDeployCounter();
|
||||||
|
|||||||
@@ -1,23 +1,38 @@
|
|||||||
#include "credits.h"
|
#include "credits.h"
|
||||||
#include "section.h" // Para Name, name, Options, options
|
#include <SDL2/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
|
||||||
#include "global_inputs.h" // Para check
|
#include <SDL2/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_QUIT
|
||||||
#include "input.h" // Para Input
|
#include <SDL2/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888
|
||||||
#include "jail_audio.h" // Para JA_StopMusic
|
#include <SDL2/SDL_rect.h> // Para SDL_Rect
|
||||||
#include "screen.h" // Para Screen
|
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
|
||||||
#include "balloon_manager.h" // Para BalloonManager
|
#include <string> // Para basic_string, string
|
||||||
#include "param.h"
|
#include <vector> // Para vector
|
||||||
#include "resource.h"
|
#include "balloon_manager.h" // Para BalloonManager
|
||||||
#include "text.h"
|
#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
|
||||||
|
|
||||||
|
// Textos
|
||||||
|
constexpr const char TEXT_COPYRIGHT[] = "@2020,2024 JailDesigner";
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Credits::Credits()
|
Credits::Credits()
|
||||||
: balloon_manager_(std::make_unique<BalloonManager>()),
|
: balloon_manager_(std::make_unique<BalloonManager>()),
|
||||||
text_texture_(SDL_CreateTexture(Screen::get()->getRenderer(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
text_texture_(SDL_CreateTexture(Screen::get()->getRenderer(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
||||||
tiled_bg_(std::make_unique<TiledBG>((SDL_Rect){0, 0, param.game.width, param.game.height}, TiledBGMode::DIAGONAL))
|
tiled_bg_(std::make_unique<TiledBG>(param.game.game_area.rect, TiledBGMode::DIAGONAL))
|
||||||
{
|
{
|
||||||
section::name = section::Name::CREDITS;
|
section::name = section::Name::CREDITS;
|
||||||
balloon_manager_->setPlayArea(param.game.game_area.rect);
|
balloon_manager_->setPlayArea(param.game.game_area.rect);
|
||||||
balloon_manager_->createTwoBigBalloons();
|
balloon_manager_->createTwoBigBalloons();
|
||||||
|
balloon_manager_->deployBalloonFormation(4,2);
|
||||||
|
balloon_manager_->deployBalloonFormation(4,5);
|
||||||
|
balloon_manager_->createPowerBall();
|
||||||
SDL_SetTextureBlendMode(text_texture_, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(text_texture_, SDL_BLENDMODE_BLEND);
|
||||||
fillTextTexture();
|
fillTextTexture();
|
||||||
JA_PlayMusic(Resource::get()->getMusic("credits.ogg"));
|
JA_PlayMusic(Resource::get()->getMusic("credits.ogg"));
|
||||||
@@ -51,7 +66,9 @@ void Credits::update()
|
|||||||
ticks_ = SDL_GetTicks();
|
ticks_ = SDL_GetTicks();
|
||||||
tiled_bg_->update();
|
tiled_bg_->update();
|
||||||
balloon_manager_->update();
|
balloon_manager_->update();
|
||||||
|
updateRects();
|
||||||
Screen::get()->update();
|
Screen::get()->update();
|
||||||
|
++counter_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,9 +81,10 @@ void Credits::render()
|
|||||||
// Limpia la pantalla
|
// Limpia la pantalla
|
||||||
Screen::get()->clean();
|
Screen::get()->clean();
|
||||||
|
|
||||||
tiled_bg_->render();
|
tiled_bg_->render();
|
||||||
balloon_manager_->render();
|
balloon_manager_->render();
|
||||||
SDL_RenderCopy(Screen::get()->getRenderer(), text_texture_, nullptr, nullptr);
|
SDL_RenderCopy(Screen::get()->getRenderer(), text_texture_, &credits_rect_src_, &credits_rect_dst_);
|
||||||
|
SDL_RenderCopy(Screen::get()->getRenderer(), text_texture_, &mini_logo_rect_src_, &mini_logo_rect_dst_);
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
Screen::get()->blit();
|
Screen::get()->blit();
|
||||||
@@ -129,42 +147,77 @@ void Credits::fillTextTexture()
|
|||||||
const int space_post_title = 3 + text->getCharacterSize();
|
const int space_post_title = 3 + text->getCharacterSize();
|
||||||
const int space_pre_title = text->getCharacterSize() * 3;
|
const int space_pre_title = text->getCharacterSize() * 3;
|
||||||
const int texts_height = 1 * text->getCharacterSize() + 7 * space_post_title + 3 * space_pre_title;
|
const int texts_height = 1 * text->getCharacterSize() + 7 * space_post_title + 3 * space_pre_title;
|
||||||
|
credits_rect_dst_.h = credits_rect_src_.h = texts_height;
|
||||||
|
|
||||||
int y = (param.game.height - texts_height) / 2;
|
int y = (param.game.height - texts_height) / 2;
|
||||||
|
y = 0;
|
||||||
text->setPalette(1);
|
text->setPalette(1);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(0), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(0), 1, no_color, 1, shdw_txt_color);
|
||||||
|
|
||||||
text->setPalette(0);
|
text->setPalette(0);
|
||||||
y += space_post_title;
|
y += space_post_title;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(4), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(4), 1, no_color, 1, shdw_txt_color);
|
||||||
|
|
||||||
y += space_pre_title;
|
y += space_pre_title;
|
||||||
text->setPalette(1);
|
text->setPalette(1);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(1), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(1), 1, no_color, 1, shdw_txt_color);
|
||||||
text->setPalette(0);
|
text->setPalette(0);
|
||||||
y += space_post_title;
|
y += space_post_title;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(4), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(4), 1, no_color, 1, shdw_txt_color);
|
||||||
|
|
||||||
y += space_pre_title;
|
y += space_pre_title;
|
||||||
text->setPalette(1);
|
text->setPalette(1);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(2), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(2), 1, no_color, 1, shdw_txt_color);
|
||||||
text->setPalette(0);
|
text->setPalette(0);
|
||||||
|
|
||||||
y += space_post_title;
|
y += space_post_title;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(5), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(5), 1, no_color, 1, shdw_txt_color);
|
||||||
y += space_post_title;
|
y += space_post_title;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(6), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(6), 1, no_color, 1, shdw_txt_color);
|
||||||
|
|
||||||
y += space_pre_title;
|
y += space_pre_title;
|
||||||
text->setPalette(1);
|
text->setPalette(1);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(3), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(3), 1, no_color, 1, shdw_txt_color);
|
||||||
text->setPalette(0);
|
text->setPalette(0);
|
||||||
y += space_post_title;
|
y += space_post_title;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(7), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(7), 1, no_color, 1, shdw_txt_color);
|
||||||
y += space_post_title;
|
y += space_post_title;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(8), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(8), 1, no_color, 1, shdw_txt_color);
|
||||||
y += space_post_title;
|
y += space_post_title;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.width / 2, y, texts.at(9), 1, no_color, 1, shdw_txt_color);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, texts.at(9), 1, no_color, 1, shdw_txt_color);
|
||||||
|
|
||||||
|
// Mini logo
|
||||||
|
y += space_pre_title;
|
||||||
|
mini_logo_rect_src_.y = y;
|
||||||
|
auto mini_logo_sprite = std::make_unique<Sprite>(Resource::get()->getTexture("logo_jailgames_mini.png"));
|
||||||
|
mini_logo_sprite->setPosition(1 + param.game.game_area.center_x - mini_logo_sprite->getWidth() / 2, 1 + y);
|
||||||
|
Resource::get()->getTexture("logo_jailgames_mini.png")->setColor(shdw_txt_color.r, shdw_txt_color.g, shdw_txt_color.b);
|
||||||
|
mini_logo_sprite->render();
|
||||||
|
|
||||||
|
mini_logo_sprite->setPosition(param.game.game_area.center_x - mini_logo_sprite->getWidth() / 2, y);
|
||||||
|
Resource::get()->getTexture("logo_jailgames_mini.png")->setColor(255, 255, 255);
|
||||||
|
mini_logo_sprite->render();
|
||||||
|
|
||||||
|
// Texto con el copyright
|
||||||
|
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();
|
||||||
|
|
||||||
SDL_SetRenderTarget(Screen::get()->getRenderer(), nullptr);
|
SDL_SetRenderTarget(Screen::get()->getRenderer(), nullptr);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actualiza el destino de los rectangulos de las texturas
|
||||||
|
void Credits::updateRects()
|
||||||
|
{
|
||||||
|
if (counter_ % 10 == 0)
|
||||||
|
{
|
||||||
|
--credits_rect_dst_.y;
|
||||||
|
--mini_logo_rect_dst_.y;
|
||||||
|
}
|
||||||
|
mini_logo_rect_dst_.y = std::max(mini_logo_rect_dst_.y, mini_logo_final_pos_);
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "SDL2/SDL.h"
|
|
||||||
#include <memory>
|
#include <SDL2/SDL_render.h> // Para SDL_Texture
|
||||||
#include "balloon_manager.h"
|
#include <SDL2/SDL_stdinc.h> // Para Uint32
|
||||||
#include "texture.h"
|
#include <memory> // Para unique_ptr
|
||||||
#include "tiled_bg.h"
|
#include "param.h"
|
||||||
|
class BalloonManager;
|
||||||
|
class TiledBG;
|
||||||
|
|
||||||
class Credits
|
class Credits
|
||||||
{
|
{
|
||||||
@@ -14,7 +16,13 @@ private:
|
|||||||
std::unique_ptr<TiledBG> tiled_bg_; // Objeto para dibujar el mosaico animado de fondo
|
std::unique_ptr<TiledBG> tiled_bg_; // Objeto para dibujar el mosaico animado de fondo
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
||||||
|
Uint32 counter_ = 0; // Contador para la lógica de la clase
|
||||||
|
SDL_Rect credits_rect_src_ = param.game.game_area.rect; // Rectangulo con el texto de los créditos (origen)
|
||||||
|
SDL_Rect credits_rect_dst_ = param.game.game_area.rect; // Rectangulo con el texto de los créditos (destino)
|
||||||
|
SDL_Rect mini_logo_rect_src_ = param.game.game_area.rect; // Rectangulo con el mini logo de JailGames y el texto de copyright (origen)
|
||||||
|
SDL_Rect mini_logo_rect_dst_ = param.game.game_area.rect; // Rectangulo con el mini logo de JailGames y el texto de copyright (destino)
|
||||||
|
int mini_logo_final_pos_ = 0;
|
||||||
|
|
||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void update();
|
void update();
|
||||||
@@ -31,6 +39,9 @@ private:
|
|||||||
// Crea la textura con el texto
|
// Crea la textura con el texto
|
||||||
void fillTextTexture();
|
void fillTextTexture();
|
||||||
|
|
||||||
|
// Actualiza el destino de los rectangulos de las texturas
|
||||||
|
void updateRects();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Credits();
|
Credits();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "balloon.h" // Para Balloon, BALLOON_SPEED
|
#include "balloon.h" // Para Balloon, BALLOON_SPEED
|
||||||
#include "balloon_manager.h" // Para BalloonManager
|
#include "balloon_manager.h" // Para BalloonManager
|
||||||
#include "bullet.h" // Para Bullet, BulletType, BulletMoveStatus
|
#include "bullet.h" // Para Bullet, BulletType, BulletMoveStatus
|
||||||
|
#include "enter_name.h" // Para NAME_LENGHT
|
||||||
#include "fade.h" // Para Fade, FadeType
|
#include "fade.h" // Para Fade, FadeType
|
||||||
#include "global_inputs.h" // Para check
|
#include "global_inputs.h" // Para check
|
||||||
#include "input.h" // Para InputType, Input, INPUT_DO_NOT_ALL...
|
#include "input.h" // Para InputType, Input, INPUT_DO_NOT_ALL...
|
||||||
@@ -30,9 +31,8 @@
|
|||||||
#include "screen.h" // Para Screen
|
#include "screen.h" // Para Screen
|
||||||
#include "section.h" // Para Name, name, Options, options
|
#include "section.h" // Para Name, name, Options, options
|
||||||
#include "smart_sprite.h" // Para SmartSprite
|
#include "smart_sprite.h" // Para SmartSprite
|
||||||
#include "stage.h" // Para get, number, Stage, power
|
#include "stage.h" // Para number, get, Stage, power, total_p...
|
||||||
#include "text.h" // Para Text
|
#include "text.h" // Para Text
|
||||||
#include "dbgtxt.h" // Para dbg_print
|
|
||||||
#include "texture.h" // Para Texture
|
#include "texture.h" // Para Texture
|
||||||
struct JA_Sound_t; // lines 37-37
|
struct JA_Sound_t; // lines 37-37
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Instructions::Instructions()
|
|||||||
texture_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
texture_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
||||||
backbuffer_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
backbuffer_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
||||||
text_(Resource::get()->getText("smb2")),
|
text_(Resource::get()->getText("smb2")),
|
||||||
tiled_bg_(std::make_unique<TiledBG>((SDL_Rect){0, 0, param.game.width, param.game.height}, TiledBGMode::STATIC)),
|
tiled_bg_(std::make_unique<TiledBG>(param.game.game_area.rect, TiledBGMode::STATIC)),
|
||||||
fade_(std::make_unique<Fade>())
|
fade_(std::make_unique<Fade>())
|
||||||
{
|
{
|
||||||
// Configura las texturas
|
// Configura las texturas
|
||||||
@@ -36,7 +36,7 @@ Instructions::Instructions()
|
|||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
section::name = section::Name::INSTRUCTIONS;
|
section::name = section::Name::INSTRUCTIONS;
|
||||||
view_ = {0, 0, param.game.width, param.game.height};
|
view_ = param.game.game_area.rect;
|
||||||
|
|
||||||
// Inicializa objetos
|
// Inicializa objetos
|
||||||
fade_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
fade_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include <algorithm> // para std::clamp
|
#include <stdlib.h> // Para rand
|
||||||
#include <stdlib.h> // para rand
|
#include <algorithm> // Para clamp
|
||||||
#include "animated_sprite.h" // para SpriteAnimated
|
#include "animated_sprite.h" // Para AnimatedSprite
|
||||||
#include "param.h" // para param
|
#include "param.h" // Para Param, ParamGame, param
|
||||||
class Texture;
|
class Texture; // lines 6-6
|
||||||
|
|
||||||
Item::Item(ItemType type, float x, float y, SDL_Rect &play_area, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation)
|
Item::Item(ItemType type, float x, float y, SDL_Rect &play_area, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation)
|
||||||
: sprite_(std::make_unique<AnimatedSprite>(texture, animation)),
|
: sprite_(std::make_unique<AnimatedSprite>(texture, animation)),
|
||||||
@@ -73,8 +73,6 @@ void Item::render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <algorithm> // Necesario para std::clamp
|
|
||||||
|
|
||||||
void Item::move()
|
void Item::move()
|
||||||
{
|
{
|
||||||
floor_collision_ = false;
|
floor_collision_ = false;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "path_sprite.h"
|
#include "path_sprite.h"
|
||||||
#include <cmath> // Para abs
|
#include <cstdlib> // Para abs
|
||||||
#include <stdlib.h> // Para abs
|
|
||||||
#include <functional> // Para function
|
#include <functional> // Para function
|
||||||
#include <utility> // Para move
|
#include <utility> // Para move
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include <SDL2/SDL_render.h> // Para SDL_FLIP_HORIZONTAL, SDL_FLIP_NONE
|
#include <SDL2/SDL_render.h> // Para SDL_FLIP_HORIZONTAL, SDL_FLIP_NONE, SDL...
|
||||||
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
|
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
|
||||||
#include <stdlib.h> // Para rand
|
#include <stdlib.h> // Para rand
|
||||||
#include <algorithm> // Para max, min
|
#include <algorithm> // Para clamp, max, min
|
||||||
#include "animated_sprite.h" // Para AnimatedSprite
|
#include "animated_sprite.h" // Para AnimatedSprite
|
||||||
#include "input.h" // Para InputType
|
#include "input.h" // Para InputType
|
||||||
#include "manage_hiscore_table.h" // Para HiScoreEntry
|
#include "param.h" // Para Param, ParamGame, param
|
||||||
#include "options.h" // Para Options, OptionsGame, options
|
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode
|
||||||
#include "param.h" // Para Param, ParamGame, param
|
#include "texture.h" // Para Texture
|
||||||
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode
|
|
||||||
#include "texture.h" // Para Texture
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Player::Player(int id, float x, int y, bool demo, SDL_Rect &play_area, std::vector<std::shared_ptr<Texture>> texture, const std::vector<std::vector<std::string>> &animations)
|
Player::Player(int id, float x, int y, bool demo, SDL_Rect &play_area, std::vector<std::shared_ptr<Texture>> texture, const std::vector<std::vector<std::string>> &animations)
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "animated_sprite.h" // Para AnimatedSprite
|
#include <SDL2/SDL_rect.h> // Para SDL_Rect
|
||||||
#include "enter_name.h" // Para EnterName
|
#include <SDL2/SDL_stdinc.h> // Para Uint32
|
||||||
#include "utils.h" // Para Circle
|
#include <memory> // Para unique_ptr, shared_ptr
|
||||||
#include <SDL2/SDL_rect.h> // Para SDL_Rect
|
#include <string> // Para string
|
||||||
#include <SDL2/SDL_stdinc.h> // Para Uint32
|
#include <vector> // Para vector
|
||||||
#include <memory> // Para unique_ptr, shared_ptr
|
#include "animated_sprite.h" // Para AnimatedSprite
|
||||||
#include <string> // Para string
|
#include "enter_name.h" // Para EnterName
|
||||||
#include <vector> // Para vector
|
#include "manage_hiscore_table.h" // Para HiScoreEntry
|
||||||
#include "options.h"
|
#include "options.h" // Para Options, OptionsGame, options
|
||||||
|
#include "utils.h" // Para Circle
|
||||||
class Texture; // lines 12-12
|
class Texture; // lines 13-13
|
||||||
enum class InputType : int; // lines 13-13
|
enum class InputType : int; // lines 14-14
|
||||||
enum class ScoreboardMode; // lines 14-14
|
enum class ScoreboardMode; // lines 15-15
|
||||||
|
|
||||||
// Estados del jugador
|
// Estados del jugador
|
||||||
enum class PlayerState
|
enum class PlayerState
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "asset.h" // Para Asset
|
#include "asset.h" // Para Asset
|
||||||
#include "dbgtxt.h" // Para dbg_print
|
#include "dbgtxt.h" // Para dbg_print
|
||||||
#include "global_inputs.h" // Para service_pressed_counter
|
#include "global_inputs.h" // Para service_pressed_counter
|
||||||
#include "jail_shader.h" // Para init, render
|
|
||||||
#include "notifier.h" // Para Notifier
|
#include "notifier.h" // Para Notifier
|
||||||
#include "on_screen_help.h" // Para OnScreenHelp
|
#include "on_screen_help.h" // Para OnScreenHelp
|
||||||
#include "options.h" // Para Options, OptionsVideo, options, Options...
|
#include "options.h" // Para Options, OptionsVideo, options, Options...
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "stage.h"
|
#include "stage.h"
|
||||||
#include <vector>
|
#include <algorithm> // Para min
|
||||||
|
#include <vector> // Para vector
|
||||||
|
|
||||||
namespace Stage
|
namespace Stage
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,15 +29,15 @@
|
|||||||
Title::Title()
|
Title::Title()
|
||||||
: text_(Resource::get()->getText("smb2")),
|
: text_(Resource::get()->getText("smb2")),
|
||||||
fade_(std::make_unique<Fade>()),
|
fade_(std::make_unique<Fade>()),
|
||||||
tiled_bg_(std::make_unique<TiledBG>((SDL_Rect){0, 0, param.game.width, param.game.height}, TiledBGMode::RANDOM)),
|
tiled_bg_(std::make_unique<TiledBG>(param.game.game_area.rect, TiledBGMode::RANDOM)),
|
||||||
game_logo_(std::make_unique<GameLogo>(param.game.game_area.center_x, param.title.title_c_c_position)),
|
game_logo_(std::make_unique<GameLogo>(param.game.game_area.center_x, param.title.title_c_c_position)),
|
||||||
mini_logo_texture_(Resource::get()->getTexture("logo_jailgames_mini.png")),
|
mini_logo_sprite_(std::make_unique<Sprite>(Resource::get()->getTexture("logo_jailgames_mini.png"))),
|
||||||
mini_logo_sprite_(std::make_unique<Sprite>(mini_logo_texture_, param.game.game_area.center_x - mini_logo_texture_->getWidth() / 2, 0, mini_logo_texture_->getWidth(), mini_logo_texture_->getHeight())),
|
|
||||||
define_buttons_(std::make_unique<DefineButtons>()),
|
define_buttons_(std::make_unique<DefineButtons>()),
|
||||||
num_controllers_(Input::get()->getNumControllers())
|
num_controllers_(Input::get()->getNumControllers())
|
||||||
{
|
{
|
||||||
// Configura objetos
|
// Configura objetos
|
||||||
game_logo_->enable();
|
game_logo_->enable();
|
||||||
|
mini_logo_sprite_->setX(param.game.game_area.center_x - mini_logo_sprite_->getWidth() / 2);
|
||||||
fade_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
fade_->setColor(fade_color.r, fade_color.g, fade_color.b);
|
||||||
fade_->setType(FadeType::RANDOM_SQUARE);
|
fade_->setType(FadeType::RANDOM_SQUARE);
|
||||||
fade_->setPost(param.fade.post_duration);
|
fade_->setPost(param.fade.post_duration);
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ private:
|
|||||||
std::unique_ptr<Fade> fade_; // Objeto para realizar fundidos en pantalla
|
std::unique_ptr<Fade> fade_; // Objeto para realizar fundidos en pantalla
|
||||||
std::unique_ptr<TiledBG> tiled_bg_; // Objeto para dibujar el mosaico animado de fondo
|
std::unique_ptr<TiledBG> tiled_bg_; // Objeto para dibujar el mosaico animado de fondo
|
||||||
std::unique_ptr<GameLogo> game_logo_; // Objeto para dibujar el logo con el título del juego
|
std::unique_ptr<GameLogo> game_logo_; // Objeto para dibujar el logo con el título del juego
|
||||||
std::shared_ptr<Texture> mini_logo_texture_; // Textura con el logo de JailGames mini
|
|
||||||
std::unique_ptr<Sprite> mini_logo_sprite_; // Sprite con el logo de JailGames mini
|
std::unique_ptr<Sprite> mini_logo_sprite_; // Sprite con el logo de JailGames mini
|
||||||
std::unique_ptr<DefineButtons> define_buttons_; // Objeto para definir los botones del joystic
|
std::unique_ptr<DefineButtons> define_buttons_; // Objeto para definir los botones del joystic
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user