Commit de vesprà tirada a la brossa
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
#include "logo.h"
|
||||
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event, SDL_QUIT, SDL...
|
||||
#include <SDL2/SDL_render.h> // for SDL_Renderer
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <utility> // for move
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for Name, name, Options, options
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "texture.h" // for Texture
|
||||
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event, SDL_QUIT, SDL...
|
||||
#include <SDL2/SDL_render.h> // for SDL_Renderer
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
|
||||
#include <utility> // for move
|
||||
#include "asset.h" // for Asset
|
||||
#include "global_inputs.h" // for check
|
||||
#include "input.h" // for Input
|
||||
#include "jail_audio.h" // for JA_StopMusic
|
||||
#include "param.h" // for param
|
||||
#include "screen.h" // for Screen
|
||||
#include "section.h" // for Name, name, Options, options
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "texture.h" // for Texture
|
||||
|
||||
// Constructor
|
||||
Logo::Logo()
|
||||
@@ -23,7 +23,7 @@ Logo::Logo()
|
||||
// Reserva memoria para los punteros
|
||||
jail_texture_ = std::make_shared<Texture>(renderer, Asset::get()->get("logo_jailgames.png"));
|
||||
since_texture_ = std::make_shared<Texture>(renderer, Asset::get()->get("logo_since_1998.png"));
|
||||
since_sprite_ = std::make_unique<Sprite>((param.game.width - since_texture_->getWidth()) / 2, 83 + jail_texture_->getHeight() + 5, since_texture_->getWidth(), since_texture_->getHeight(), since_texture_);
|
||||
since_sprite_ = std::make_unique<Sprite>(since_texture_, (param.game.width - since_texture_->getWidth()) / 2, 83 + jail_texture_->getHeight() + 5, since_texture_->getWidth(), since_texture_->getHeight());
|
||||
|
||||
// Inicializa variables
|
||||
counter_ = 0;
|
||||
@@ -38,7 +38,7 @@ Logo::Logo()
|
||||
// Crea los sprites de cada linea
|
||||
for (int i = 0; i < jail_texture_->getHeight(); ++i)
|
||||
{
|
||||
auto temp = std::make_unique<Sprite>(0, i, jail_texture_->getWidth(), 1, jail_texture_);
|
||||
auto temp = std::make_unique<Sprite>(jail_texture_, 0, i, jail_texture_->getWidth(), 1);
|
||||
temp->setSpriteClip(0, i, jail_texture_->getWidth(), 1);
|
||||
const int posX = (i % 2 == 0) ? param.game.width + (i * 3) : -jail_texture_->getWidth() - (i * 3);
|
||||
temp->setPosX(posX);
|
||||
@@ -115,12 +115,12 @@ void Logo::updateJAILGAMES()
|
||||
{
|
||||
for (int i = 0; i < (int)jail_sprite_.size(); ++i)
|
||||
{
|
||||
if (jail_sprite_[i]->getIntPosX() != dest_.x)
|
||||
if (jail_sprite_[i]->getPosX() != dest_.x)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
jail_sprite_[i]->incPosX(-SPEED);
|
||||
if (jail_sprite_[i]->getIntPosX() < dest_.x)
|
||||
if (jail_sprite_[i]->getPosX() < dest_.x)
|
||||
{
|
||||
jail_sprite_[i]->setPosX(dest_.x);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ void Logo::updateJAILGAMES()
|
||||
else
|
||||
{
|
||||
jail_sprite_[i]->incPosX(SPEED);
|
||||
if (jail_sprite_[i]->getIntPosX() > dest_.x)
|
||||
if (jail_sprite_[i]->getPosX() > dest_.x)
|
||||
{
|
||||
jail_sprite_[i]->setPosX(dest_.x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user