forked from jaildesigner-jailgames/jaildoctors_dilemma
Ya es posible desplazarse de forma prematura por la lista de logros
This commit is contained in:
@@ -1220,18 +1220,25 @@ void Director::initInput()
|
|||||||
input->bindKey(input_jump, SDL_SCANCODE_UP);
|
input->bindKey(input_jump, SDL_SCANCODE_UP);
|
||||||
input->bindKey(input_left, SDL_SCANCODE_LEFT);
|
input->bindKey(input_left, SDL_SCANCODE_LEFT);
|
||||||
input->bindKey(input_right, SDL_SCANCODE_RIGHT);
|
input->bindKey(input_right, SDL_SCANCODE_RIGHT);
|
||||||
|
input->bindKey(input_up, SDL_SCANCODE_UP);
|
||||||
|
input->bindKey(input_down, SDL_SCANCODE_DOWN);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (options->keys == ctrl_opqa)
|
else if (options->keys == ctrl_opqa)
|
||||||
{
|
{
|
||||||
input->bindKey(input_jump, SDL_SCANCODE_Q);
|
input->bindKey(input_jump, SDL_SCANCODE_Q);
|
||||||
input->bindKey(input_left, SDL_SCANCODE_O);
|
input->bindKey(input_left, SDL_SCANCODE_O);
|
||||||
input->bindKey(input_right, SDL_SCANCODE_P);
|
input->bindKey(input_right, SDL_SCANCODE_P);
|
||||||
|
input->bindKey(input_up, SDL_SCANCODE_Q);
|
||||||
|
input->bindKey(input_down, SDL_SCANCODE_A);
|
||||||
}
|
}
|
||||||
else if (options->keys == ctrl_wasd)
|
else if (options->keys == ctrl_wasd)
|
||||||
{
|
{
|
||||||
input->bindKey(input_jump, SDL_SCANCODE_W);
|
input->bindKey(input_jump, SDL_SCANCODE_W);
|
||||||
input->bindKey(input_left, SDL_SCANCODE_A);
|
input->bindKey(input_left, SDL_SCANCODE_A);
|
||||||
input->bindKey(input_right, SDL_SCANCODE_D);
|
input->bindKey(input_right, SDL_SCANCODE_D);
|
||||||
|
input->bindKey(input_up, SDL_SCANCODE_W);
|
||||||
|
input->bindKey(input_down, SDL_SCANCODE_S);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Teclado - Otros
|
// Teclado - Otros
|
||||||
|
|||||||
@@ -56,26 +56,27 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
|||||||
pressEnterSprite = new Sprite(128 - (pressEnterTexture->getWidth() / 2), 192 / 5 * 4, pressEnterTexture->getWidth(), pressEnterTexture->getHeight(), pressEnterTexture, renderer);
|
pressEnterSprite = new Sprite(128 - (pressEnterTexture->getWidth() / 2), 192 / 5 * 4, pressEnterTexture->getWidth(), pressEnterTexture->getHeight(), pressEnterTexture, renderer);
|
||||||
|
|
||||||
// Crea la textura con el listado de logros
|
// Crea la textura con el listado de logros
|
||||||
|
const vector<cheevos_t> cheevosList = cheevos->list();
|
||||||
|
const int iconSize = 16; // Altura del icono que representa a cada logro
|
||||||
|
const int cheevoHeight = iconSize + 2; // EL espacio que ocupa cada logro es igual a la altura del icono mas dos pixeles de separación
|
||||||
cheevosTexture = new Texture(renderer);
|
cheevosTexture = new Texture(renderer);
|
||||||
cheevosTexture->createBlank(renderer, GAMECANVAS_WIDTH - 8, GAMECANVAS_HEIGHT - 8, SDL_TEXTUREACCESS_TARGET);
|
cheevosTexture->createBlank(renderer, GAMECANVAS_WIDTH - 8, cheevoHeight * cheevosList.size(), SDL_TEXTUREACCESS_TARGET);
|
||||||
cheevosTexture->setAsRenderTarget(renderer);
|
cheevosTexture->setAsRenderTarget(renderer);
|
||||||
cheevosTexture->setBlendMode(SDL_BLENDMODE_BLEND);
|
cheevosTexture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||||
const color_t cheevosBGColor = stringToColor(options->palette, "blue");
|
const color_t cheevosBGColor = stringToColor(options->palette, "blue");
|
||||||
SDL_SetRenderDrawColor(renderer, cheevosBGColor.r, cheevosBGColor.g, cheevosBGColor.b, 0xFF);
|
SDL_SetRenderDrawColor(renderer, cheevosBGColor.r, cheevosBGColor.g, cheevosBGColor.b, 0xFF);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
const vector<cheevos_t> cheevosList = cheevos->list();
|
infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTexture->getWidth() / 2, 2, "ACHIEVEMENTS (0 / 12)", 1, stringToColor(options->palette, "bright_white"));
|
||||||
int pos = 2;
|
int pos = 9;
|
||||||
const color_t cheevoLockedColor = stringToColor(options->palette, "white");
|
const color_t cheevoLockedColor = stringToColor(options->palette, "white");
|
||||||
const color_t cheevoUnlockedColor = stringToColor(options->palette, "bright_white");
|
const color_t cheevoUnlockedColor = stringToColor(options->palette, "bright_white");
|
||||||
color_t cheevoColor;
|
color_t cheevoColor;
|
||||||
|
|
||||||
Texture *iconTexture = new Texture(renderer, asset->get("notify.png"));
|
Texture *iconTexture = new Texture(renderer, asset->get("notify.png"));
|
||||||
const int iconSize = 16;
|
|
||||||
Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer);
|
Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer);
|
||||||
for (auto cheevo : cheevosList)
|
for (auto cheevo : cheevosList)
|
||||||
{
|
{
|
||||||
cheevoColor = cheevo.completed ? cheevoUnlockedColor : cheevoLockedColor;
|
cheevoColor = cheevo.completed ? cheevoUnlockedColor : cheevoLockedColor;
|
||||||
//const int iconIndex = cheevo.completed ? 3 : 2;
|
|
||||||
sp->setPos({2, pos, iconSize, iconSize});
|
sp->setPos({2, pos, iconSize, iconSize});
|
||||||
sp->setSpriteClip({iconSize * 2, 0, iconSize, iconSize});
|
sp->setSpriteClip({iconSize * 2, 0, iconSize, iconSize});
|
||||||
sp->getTexture()->setColor(cheevoColor.r, cheevoColor.g, cheevoColor.b);
|
sp->getTexture()->setColor(cheevoColor.r, cheevoColor.g, cheevoColor.b);
|
||||||
@@ -91,6 +92,8 @@ 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};
|
||||||
|
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||||
|
|
||||||
// Cambia el color del borde
|
// Cambia el color del borde
|
||||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||||
@@ -160,6 +163,19 @@ void Title::checkEventHandler()
|
|||||||
// Comprueba las entradas
|
// Comprueba las entradas
|
||||||
void Title::checkInput()
|
void Title::checkInput()
|
||||||
{
|
{
|
||||||
|
if (showCheevos)
|
||||||
|
{
|
||||||
|
if (input->checkInput(input_down, REPEAT_TRUE))
|
||||||
|
{
|
||||||
|
cheevosTextureView.y++;
|
||||||
|
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||||
|
}
|
||||||
|
else if (input->checkInput(input_up, REPEAT_TRUE))
|
||||||
|
{
|
||||||
|
cheevosTextureView.y--;
|
||||||
|
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ private:
|
|||||||
struct letter_t
|
struct letter_t
|
||||||
{
|
{
|
||||||
string letter; // Letra a escribir
|
string letter; // Letra a escribir
|
||||||
int x; // Posición en el eje x
|
int x; // Posición en el eje x
|
||||||
bool enabled; // Solo se escriben y mueven si estan habilitadas
|
bool enabled; // Solo se escriben y mueven si estan habilitadas
|
||||||
};
|
};
|
||||||
|
|
||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
@@ -48,13 +48,14 @@ private:
|
|||||||
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
int counter; // Contador
|
int counter; // Contador
|
||||||
string longText; // Texto que aparece en la parte inferior del titulo
|
string longText; // Texto que aparece en la parte inferior del titulo
|
||||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||||
vector<letter_t> letters; // Vector con las letras de la marquesina
|
vector<letter_t> letters; // Vector con las letras de la marquesina
|
||||||
int marqueeSpeed; // Velocidad de desplazamiento de la marquesina
|
int marqueeSpeed; // Velocidad de desplazamiento de la marquesina
|
||||||
bool showCheevos; // Indica si se muestra por pantalla el listado de logros
|
bool showCheevos; // Indica si se muestra por pantalla el listado de logros
|
||||||
|
SDL_Rect cheevosTextureView; // Zona visible de la textura con el listado de logros
|
||||||
|
|
||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
Reference in New Issue
Block a user