Modificada la estructura on es guarden els datos de la demo
This commit is contained in:
@@ -23,29 +23,21 @@
|
||||
|
||||
// Constructor
|
||||
HiScoreTable::HiScoreTable()
|
||||
: renderer_(Screen::get()->getRenderer()),
|
||||
backbuffer_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
||||
fade_(std::make_unique<Fade>()),
|
||||
background_(std::make_unique<Background>()),
|
||||
text_(std::make_unique<Text>(Resource::get()->getTexture("smb2.gif"), Resource::get()->getTextFile("smb2.txt"))),
|
||||
counter_(0),
|
||||
ticks_(0),
|
||||
view_area_({0, 0, param.game.width, param.game.height}),
|
||||
fade_mode_(FadeMode::IN)
|
||||
{
|
||||
// Copia punteros
|
||||
renderer_ = Screen::get()->getRenderer();
|
||||
|
||||
// Objetos
|
||||
fade_ = std::make_unique<Fade>();
|
||||
background_ = std::make_unique<Background>(renderer_);
|
||||
text_ = std::make_unique<Text>(Resource::get()->getTexture("smb2.gif"), Resource::get()->getTextFile("smb2.txt"));
|
||||
|
||||
// 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);
|
||||
|
||||
// Inicializa variables
|
||||
// Inicializa el resto de variables
|
||||
section::name = section::Name::HI_SCORE_TABLE;
|
||||
ticks_ = 0;
|
||||
ticks_speed_ = 15;
|
||||
counter_ = 0;
|
||||
counter_end_ = 800;
|
||||
view_area_ = {0, 0, param.game.width, param.game.height};
|
||||
fade_mode_ = FadeMode::IN;
|
||||
|
||||
// Inicializa objetos
|
||||
SDL_SetTextureBlendMode(backbuffer_, SDL_BLENDMODE_BLEND);
|
||||
background_->setPos(param.game.game_area.rect);
|
||||
background_->setCloudsSpeed(-0.1f);
|
||||
background_->setGradientNumber(1);
|
||||
@@ -70,7 +62,7 @@ HiScoreTable::~HiScoreTable()
|
||||
void HiScoreTable::update()
|
||||
{
|
||||
// Actualiza las variables
|
||||
if (SDL_GetTicks() - ticks_ > ticks_speed_)
|
||||
if (SDL_GetTicks() - ticks_ > TICKS_SPEED_)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks_ = SDL_GetTicks();
|
||||
@@ -99,7 +91,7 @@ void HiScoreTable::update()
|
||||
background_->setAlpha(96);
|
||||
}
|
||||
|
||||
if (counter_ == counter_end_)
|
||||
if (counter_ == COUNTER_END_)
|
||||
{
|
||||
fade_->activate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user