Trabajando en la recarga de texturas

This commit is contained in:
2022-10-27 07:25:59 +02:00
parent 02cc3b3527
commit 32dd85525b
7 changed files with 93 additions and 20 deletions

View File

@@ -14,13 +14,13 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
eventHandler = new SDL_Event();
if (options->palette == p_zxspectrum)
{
loadingScreenTexture1 =resource->getTexture("loading_screen_bn.png");
loadingScreenTexture2 =resource->getTexture("loading_screen_color.png");
loadingScreenTexture1 = resource->getTexture("loading_screen_bn.png");
loadingScreenTexture2 = resource->getTexture("loading_screen_color.png");
}
else if (options->palette == p_zxarne)
{
loadingScreenTexture1 =resource->getTexture("loading_screen_bn_zxarne.png");
loadingScreenTexture2 =resource->getTexture("loading_screen_color_zxarne.png");
loadingScreenTexture1 = resource->getTexture("loading_screen_bn_zxarne.png");
loadingScreenTexture2 = resource->getTexture("loading_screen_color_zxarne.png");
}
sprite1 = new Sprite(0, 0, loadingScreenTexture1->getWidth(), loadingScreenTexture1->getHeight(), loadingScreenTexture1, renderer);
sprite2 = new Sprite(0, 0, loadingScreenTexture2->getWidth(), loadingScreenTexture2->getHeight(), loadingScreenTexture2, renderer);
@@ -97,8 +97,46 @@ void Intro::checkEventHandler()
// Cualquier tecla pulsada
if ((eventHandler->type == SDL_KEYDOWN) || (eventHandler->type == SDL_JOYBUTTONDOWN))
{
section.name = SECTION_PROG_TITLE;
section.subsection = 0;
switch (eventHandler->key.keysym.scancode)
{
case SDL_SCANCODE_B:
screen->switchBorder();
resource->reLoadTextures();
break;
case SDL_SCANCODE_F:
screen->switchVideoMode();
resource->reLoadTextures();
break;
case SDL_SCANCODE_F1:
screen->setWindowSize(1);
resource->reLoadTextures();
break;
case SDL_SCANCODE_F2:
screen->setWindowSize(2);
resource->reLoadTextures();
break;
case SDL_SCANCODE_F3:
screen->setWindowSize(3);
resource->reLoadTextures();
break;
case SDL_SCANCODE_F4:
screen->setWindowSize(4);
resource->reLoadTextures();
break;
case SDL_SCANCODE_F5:
switchPalette();
break;
default:
section.name = SECTION_PROG_TITLE;
break;
}
}
}
}
@@ -248,3 +286,20 @@ section_t Intro::run()
return section;
}
// Cambia la paleta
void Intro::switchPalette()
{
if (options->palette == p_zxspectrum)
{
options->palette = p_zxarne;
loadingScreenTexture1 = resource->getTexture("loading_screen_bn_zxarne.png");
loadingScreenTexture2 = resource->getTexture("loading_screen_color_zxarne.png");
}
else
{
options->palette = p_zxspectrum;
loadingScreenTexture1 = resource->getTexture("loading_screen_bn.png");
loadingScreenTexture2 = resource->getTexture("loading_screen_color.png");
}
}