forked from jaildesigner-jailgames/jaildoctors_dilemma
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
|
// Crea el sprite para el listado de logros
|
||||||
cheevosSprite = new Sprite(4, 4, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
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);
|
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||||
|
|
||||||
// Cambia el color del borde
|
// Cambia el color del borde
|
||||||
@@ -167,13 +167,11 @@ void Title::checkInput()
|
|||||||
{
|
{
|
||||||
if (input->checkInput(input_down, REPEAT_TRUE))
|
if (input->checkInput(input_down, REPEAT_TRUE))
|
||||||
{
|
{
|
||||||
cheevosTextureView.y++;
|
moveCheevosList(1);
|
||||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
|
||||||
}
|
}
|
||||||
else if (input->checkInput(input_up, REPEAT_TRUE))
|
else if (input->checkInput(input_up, REPEAT_TRUE))
|
||||||
{
|
{
|
||||||
cheevosTextureView.y--;
|
moveCheevosList(0);
|
||||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,3 +378,17 @@ void Title::switchPalette()
|
|||||||
// Cambia el color del borde
|
// Cambia el color del borde
|
||||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
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
|
// Cambia la paleta
|
||||||
void switchPalette();
|
void switchPalette();
|
||||||
|
|
||||||
|
// Desplaza la lista de logros
|
||||||
|
void moveCheevosList(int direction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
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