Commit para seguir programando en WSL
This commit is contained in:
113
source/logo.cpp
113
source/logo.cpp
@@ -2,13 +2,14 @@
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section)
|
||||
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->resource = resource;
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
@@ -80,56 +81,57 @@ void Logo::checkEventHandler()
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section->name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
// Comprueba las entradas
|
||||
void Logo::checkInput()
|
||||
{
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
screen->switchBorder();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
screen->switchVideoMode();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_video_mode, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_size_1, REPEAT_FALSE))
|
||||
{
|
||||
screen->setWindowSize(1);
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_size_2, REPEAT_FALSE))
|
||||
{
|
||||
screen->setWindowSize(2);
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
|
||||
{
|
||||
screen->setWindowSize(3);
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
switchPalette();
|
||||
break;
|
||||
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
|
||||
{
|
||||
screen->setWindowSize(4);
|
||||
}
|
||||
|
||||
default:
|
||||
section->subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
endSection();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
}
|
||||
|
||||
else if (input->checkAnyInput())
|
||||
{
|
||||
section->subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,32 +177,32 @@ void Logo::updateTextureColors()
|
||||
{
|
||||
texture2->setColor(color[0].r, color[0].g, color[0].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == ini + inc * 1)
|
||||
{
|
||||
texture2->setColor(color[1].r, color[1].g, color[1].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == ini + inc * 2)
|
||||
{
|
||||
texture2->setColor(color[2].r, color[2].g, color[2].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == ini + inc * 3)
|
||||
{
|
||||
texture2->setColor(color[3].r, color[3].g, color[3].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == ini + inc * 4)
|
||||
{
|
||||
texture2->setColor(color[4].r, color[4].g, color[4].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == ini + inc * 5)
|
||||
{
|
||||
texture2->setColor(color[5].r, color[5].g, color[5].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == ini + inc * 6)
|
||||
{
|
||||
texture2->setColor(color[6].r, color[6].g, color[6].b);
|
||||
@@ -216,37 +218,37 @@ void Logo::updateTextureColors()
|
||||
texture->setColor(color[6].r, color[6].g, color[6].b);
|
||||
texture2->setColor(color[6].r, color[6].g, color[6].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == initFade + inc * 1)
|
||||
{
|
||||
texture->setColor(color[5].r, color[5].g, color[5].b);
|
||||
texture2->setColor(color[5].r, color[5].g, color[5].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == initFade + inc * 2)
|
||||
{
|
||||
texture->setColor(color[4].r, color[4].g, color[4].b);
|
||||
texture2->setColor(color[4].r, color[4].g, color[4].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == initFade + inc * 3)
|
||||
{
|
||||
texture->setColor(color[3].r, color[3].g, color[3].b);
|
||||
texture2->setColor(color[3].r, color[3].g, color[3].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == initFade + inc * 4)
|
||||
{
|
||||
texture->setColor(color[2].r, color[2].g, color[2].b);
|
||||
texture2->setColor(color[2].r, color[2].g, color[2].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == initFade + inc * 5)
|
||||
{
|
||||
texture->setColor(color[1].r, color[1].g, color[1].b);
|
||||
texture2->setColor(color[1].r, color[1].g, color[1].b);
|
||||
}
|
||||
|
||||
|
||||
else if (counter == initFade + inc * 6)
|
||||
{
|
||||
texture->setColor(color[0].r, color[0].g, color[0].b);
|
||||
@@ -266,6 +268,9 @@ void Logo::update()
|
||||
// Comprueba el manejador de eventos
|
||||
checkEventHandler();
|
||||
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Incrementa el contador
|
||||
counter++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user