forked from jaildesigner-jailgames/jaildoctors_dilemma
Añadido efectos en el borde para imitar la carga de la pantalla como en el spectrum
This commit is contained in:
@@ -196,6 +196,42 @@ void Intro::renderLoad()
|
||||
loadingFirstPart ? sprite1->render() : sprite2->render();
|
||||
}
|
||||
|
||||
// Dibuja el efecto de carga en el borde
|
||||
void Intro::renderBorder()
|
||||
{
|
||||
// Pinta el borde de colro azul
|
||||
color_t color = stringToColor(options->palette, "blue");
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Añade lineas amarillas
|
||||
color = stringToColor(options->palette, "yellow");
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
const int width = GAMECANVAS_WIDTH + (options->borderWidth * 2);
|
||||
const int height = GAMECANVAS_HEIGHT + (options->borderHeight * 2);
|
||||
bool drawEnabled = rand() % 2 == 0 ? true : false;
|
||||
// for (int i = 0; i < height; ++i)
|
||||
//{
|
||||
// if (rand() % 2 == 0)
|
||||
// {
|
||||
// SDL_RenderDrawLine(renderer, 0, i, width, i);
|
||||
// }
|
||||
// }
|
||||
int row = 0;
|
||||
int rowSize = 1;
|
||||
while (row < height)
|
||||
{
|
||||
rowSize = (rand() % 4) + 3;
|
||||
if (drawEnabled)
|
||||
for (int i = row; i < row + rowSize; ++i)
|
||||
{
|
||||
SDL_RenderDrawLine(renderer, 0, i, width, i);
|
||||
}
|
||||
row += rowSize;
|
||||
drawEnabled = !drawEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
void Intro::update()
|
||||
{
|
||||
@@ -222,6 +258,15 @@ void Intro::update()
|
||||
// Dibuja en pantalla
|
||||
void Intro::render()
|
||||
{
|
||||
if (options->borderEnabled)
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura del borde
|
||||
screen->startDrawOnBorder();
|
||||
|
||||
// Dibuja el efecto de carga en el borde
|
||||
renderBorder();
|
||||
}
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ private:
|
||||
// Dibuja la pantalla de carga
|
||||
void renderLoad();
|
||||
|
||||
// Dibuja el efecto de carga en el borde
|
||||
void renderBorder();
|
||||
|
||||
// Cambia la paleta
|
||||
void switchPalette();
|
||||
|
||||
|
||||
@@ -320,5 +320,13 @@ void Logo::switchPalette()
|
||||
// Termina la sección
|
||||
void Logo::endSection()
|
||||
{
|
||||
section->name = SECTION_PROG_INTRO;
|
||||
if (section->subsection == SUBSECTION_LOGO_TO_TITLE)
|
||||
{
|
||||
section->name = SECTION_PROG_TITLE;
|
||||
}
|
||||
|
||||
else if (section->subsection == SUBSECTION_LOGO_TO_INTRO)
|
||||
{
|
||||
section->name = SECTION_PROG_INTRO;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user