Terminado el desplazamiento por la lista de logros
This commit is contained in:
@@ -92,7 +92,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
|
||||
// Crea el sprite para el listado de logros
|
||||
cheevosSprite = new Sprite(4, 4, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
||||
cheevosTextureView = {0, 20, GAMECANVAS_WIDTH - 8, GAMECANVAS_HEIGHT - 8};
|
||||
cheevosTextureView = {0, 0, GAMECANVAS_WIDTH - 8, GAMECANVAS_HEIGHT - 8};
|
||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||
|
||||
// Cambia el color del borde
|
||||
@@ -167,13 +167,11 @@ void Title::checkInput()
|
||||
{
|
||||
if (input->checkInput(input_down, REPEAT_TRUE))
|
||||
{
|
||||
cheevosTextureView.y++;
|
||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||
moveCheevosList(1);
|
||||
}
|
||||
else if (input->checkInput(input_up, REPEAT_TRUE))
|
||||
{
|
||||
cheevosTextureView.y--;
|
||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||
moveCheevosList(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,3 +378,17 @@ void Title::switchPalette()
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||
}
|
||||
|
||||
// Desplaza la lista de logros
|
||||
void Title::moveCheevosList(int direction)
|
||||
{
|
||||
cheevosTextureView.y = direction == 0 ? cheevosTextureView.y - 1 : cheevosTextureView.y + 1;
|
||||
|
||||
const int bottom = cheevosTexture->getHeight() - cheevosTextureView.h;
|
||||
if (cheevosTextureView.y < 0)
|
||||
cheevosTextureView.y = 0;
|
||||
else if (cheevosTextureView.y > bottom)
|
||||
cheevosTextureView.y = bottom;
|
||||
|
||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||
}
|
||||
@@ -87,6 +87,9 @@ private:
|
||||
// Cambia la paleta
|
||||
void switchPalette();
|
||||
|
||||
// Desplaza la lista de logros
|
||||
void moveCheevosList(int direction);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||
|
||||
Reference in New Issue
Block a user