Arreglado el cambio de paleta durante la pantalla de carga optimizada
This commit is contained in:
@@ -127,7 +127,7 @@ void Intro::checkEventHandler()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_SCANCODE_F5:
|
case SDL_SCANCODE_F5:
|
||||||
//switchPalette();
|
switchPalette();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -142,7 +142,7 @@ void Intro::checkEventHandler()
|
|||||||
// Gestiona el contador de carga
|
// Gestiona el contador de carga
|
||||||
void Intro::updateLoad()
|
void Intro::updateLoad()
|
||||||
{
|
{
|
||||||
// Primera parte de la carga, la parte en blanco ynegro
|
// Primera parte de la carga, la parte en blanco y negro
|
||||||
if (loadingFirstPart)
|
if (loadingFirstPart)
|
||||||
{
|
{
|
||||||
// Cada 5 pasos el loadCounter se incrementa en uno
|
// Cada 5 pasos el loadCounter se incrementa en uno
|
||||||
@@ -271,4 +271,45 @@ void Intro::switchPalette()
|
|||||||
sprite1->setTexture(resource->getTexture("loading_screen_bn.png"));
|
sprite1->setTexture(resource->getTexture("loading_screen_bn.png"));
|
||||||
sprite2->setTexture(resource->getTexture("loading_screen_color.png"));
|
sprite2->setTexture(resource->getTexture("loading_screen_color.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recreateLoadingScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reconstruye la pantalla de carga
|
||||||
|
void Intro::recreateLoadingScreen()
|
||||||
|
{
|
||||||
|
// Prepara para empezar a dibujar en la textura de juego
|
||||||
|
screen->start();
|
||||||
|
|
||||||
|
// Primera parte de la carga, la parte en blanco y negro
|
||||||
|
if (loadingFirstPart)
|
||||||
|
{
|
||||||
|
const int numSteps = 5;
|
||||||
|
const int step = 51;
|
||||||
|
|
||||||
|
for (int i = 0; i <= counter; i++)
|
||||||
|
{
|
||||||
|
loadCounter = i / numSteps;
|
||||||
|
loadRect.x = step * (i % numSteps);
|
||||||
|
loadRect.y = lineIndex[loadCounter];
|
||||||
|
sprite1->setSpriteClip(loadRect);
|
||||||
|
sprite1->setRect(loadRect);
|
||||||
|
sprite1->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Segunda parte de la carga, la parte de los bloques en color
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= loadCounter; i++)
|
||||||
|
{
|
||||||
|
loadRect.x = (i * 8) % 256;
|
||||||
|
loadRect.y = (i / 32) * 8;
|
||||||
|
sprite2->setSpriteClip(loadRect);
|
||||||
|
sprite2->setRect(loadRect);
|
||||||
|
sprite2->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
|
screen->blit();
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,9 @@ private:
|
|||||||
// Cambia la paleta
|
// Cambia la paleta
|
||||||
void switchPalette();
|
void switchPalette();
|
||||||
|
|
||||||
|
// Reconstruye la pantalla de carga
|
||||||
|
void recreateLoadingScreen();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section);
|
Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section);
|
||||||
|
|||||||
Reference in New Issue
Block a user