Optimizando la intro
This commit is contained in:
@@ -377,9 +377,9 @@ void Screen::renderNotifications()
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_RenderSetLogicalSize(renderer, notificationLogicalWidth, notificationLogicalHeight);
|
||||
//SDL_RenderSetLogicalSize(renderer, notificationLogicalWidth, notificationLogicalHeight);
|
||||
notify->render();
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
//SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
}
|
||||
|
||||
// Establece el tamaño de las notificaciones
|
||||
|
||||
@@ -18,7 +18,7 @@ Director::Director(int argc, char *argv[])
|
||||
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||
|
||||
#ifdef DEBUG
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
section.name = SECTION_PROG_INTRO;
|
||||
#endif
|
||||
|
||||
// Crea e inicializa las opciones del programa
|
||||
|
||||
@@ -38,6 +38,7 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
loadCounter = 0;
|
||||
lineCounter = 0;
|
||||
loadingFirstPart = true;
|
||||
loadRect = {0, 0, 50, 1};
|
||||
|
||||
// Ls lineas que tapan la primera textura
|
||||
for (int i = 0; i < 192; ++i)
|
||||
@@ -151,7 +152,7 @@ void Intro::updateLoad()
|
||||
{
|
||||
// Primera parte de la carga, la parte en blanco ynegro
|
||||
if (loadingFirstPart)
|
||||
{
|
||||
/*{
|
||||
// Cada 5 pasos el loadCounter se incrementa en uno
|
||||
const int numSteps = 5;
|
||||
loadCounter = counter / numSteps;
|
||||
@@ -168,6 +169,28 @@ void Intro::updateLoad()
|
||||
}
|
||||
}
|
||||
|
||||
// Una vez actualizadas las 192 lineas, pasa a la segunda fase de la carga
|
||||
else if (loadCounter == 192)
|
||||
{
|
||||
loadingFirstPart = false;
|
||||
loadCounter = 0;
|
||||
JA_PlayMusic(loadingSound3);
|
||||
}
|
||||
}*/
|
||||
{
|
||||
// Cada 5 pasos el loadCounter se incrementa en uno
|
||||
const int numSteps = 5;
|
||||
loadCounter = counter / numSteps;
|
||||
|
||||
if (loadCounter < 192)
|
||||
{
|
||||
const int step = 256 / numSteps;
|
||||
lines[lineIndex[loadCounter]].x1 = step * (counter % numSteps);
|
||||
loadRect.x = step * (counter % numSteps);
|
||||
loadRect.y = lineIndex[loadCounter];
|
||||
sprite1->setSpriteClip(loadRect);
|
||||
sprite1->setRect(loadRect);
|
||||
}
|
||||
// Una vez actualizadas las 192 lineas, pasa a la segunda fase de la carga
|
||||
else if (loadCounter == 192)
|
||||
{
|
||||
@@ -206,7 +229,7 @@ void Intro::renderLoad()
|
||||
{
|
||||
// Carga 1 - Blanco y negro
|
||||
if (loadingFirstPart)
|
||||
{
|
||||
/*{
|
||||
// Dibuja la textura de pantalla de carga en blanco y negro en pantalla
|
||||
sprite1->render();
|
||||
|
||||
@@ -216,6 +239,9 @@ void Intro::renderLoad()
|
||||
{
|
||||
SDL_RenderDrawLine(renderer, lines[i].x1, lines[i].y, lines[i].x2, lines[i].y);
|
||||
}
|
||||
}*/
|
||||
{
|
||||
sprite1->render();
|
||||
}
|
||||
else
|
||||
// Carga 2 - Color
|
||||
@@ -271,6 +297,9 @@ void Intro::render()
|
||||
screen->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
// screen->clean();
|
||||
|
||||
if (!loadingFirstPart)
|
||||
screen->clean();
|
||||
|
||||
// Dibuja la pantalla de carga
|
||||
|
||||
@@ -45,6 +45,7 @@ private:
|
||||
JA_Music loadingSound3; // Sonidos para imitar la carga tipo spectrum
|
||||
h_line_t lines[192]; // Las 192 lineas que forman la pantalla de carga
|
||||
int lineIndex[192]; // El orden en el que se procesan las 192 lineas de la pantalla de carga
|
||||
SDL_Rect loadRect;
|
||||
|
||||
// Actualiza las variables
|
||||
void update();
|
||||
|
||||
Reference in New Issue
Block a user