Reestructurant la classe Options
This commit is contained in:
@@ -34,8 +34,8 @@ Ending2::Ending2()
|
||||
preCounter = 0;
|
||||
postCounter = 0;
|
||||
postCounterEnabled = false;
|
||||
options.section.name = SECTION_ENDING2;
|
||||
options.section.subsection = 0;
|
||||
options.section.section = Section::ENDING2;
|
||||
options.section.subsection = Subsection::NONE;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
distSpriteText = 8;
|
||||
@@ -45,14 +45,14 @@ Ending2::Ending2()
|
||||
secondCol = GAMECANVAS_THIRD_QUARTER_X - (GAMECANVAS_WIDTH / 16);
|
||||
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<std::string> colorList = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"};
|
||||
for (auto cl : colorList)
|
||||
const std::vector<std::string> color_list = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"};
|
||||
for (auto color : color_list)
|
||||
{
|
||||
colors.push_back(stringToColor(options.palette, cl));
|
||||
colors.push_back(stringToColor(options.video.palette, color));
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options.palette, "black"));
|
||||
screen->setBorderColor(stringToColor(options.video.palette, "black"));
|
||||
|
||||
// Inicializa la lista de sprites
|
||||
iniSpriteList();
|
||||
@@ -126,7 +126,7 @@ void Ending2::render()
|
||||
screen->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->clean(stringToColor(options.palette, "black"));
|
||||
screen->clean(stringToColor(options.video.palette, "black"));
|
||||
|
||||
// Dibuja los sprites
|
||||
renderSprites();
|
||||
@@ -207,7 +207,7 @@ void Ending2::run()
|
||||
{
|
||||
JA_PlayMusic(music);
|
||||
|
||||
while (options.section.name == SECTION_ENDING2)
|
||||
while (options.section.section == Section::ENDING2)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
@@ -238,8 +238,8 @@ void Ending2::updateCounters()
|
||||
|
||||
if (postCounter > 600)
|
||||
{
|
||||
options.section.name = SECTION_LOGO;
|
||||
options.section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||
options.section.section = Section::LOGO;
|
||||
options.section.subsection = Subsection::LOGO_TO_INTRO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ void Ending2::updateTexts()
|
||||
// Dibuja los sprites
|
||||
void Ending2::renderSprites()
|
||||
{
|
||||
const color_t color = stringToColor(options.palette, "red");
|
||||
const Color color = stringToColor(options.video.palette, "red");
|
||||
for (auto sprite : sprites)
|
||||
{
|
||||
const bool a = sprite->getRect().y + sprite->getRect().h > 0;
|
||||
@@ -390,7 +390,7 @@ void Ending2::renderSprites()
|
||||
}
|
||||
|
||||
// Pinta el ultimo elemento de otro color
|
||||
const color_t c = stringToColor(options.palette, "white");
|
||||
const Color c = stringToColor(options.video.palette, "white");
|
||||
sprites.back()->getTexture()->setColor(c.r, c.g, c.b);
|
||||
sprites.back()->render();
|
||||
}
|
||||
@@ -398,7 +398,7 @@ void Ending2::renderSprites()
|
||||
// Dibuja los sprites con el texto
|
||||
void Ending2::renderSpriteTexts()
|
||||
{
|
||||
const color_t color = stringToColor(options.palette, "white");
|
||||
const Color color = stringToColor(options.video.palette, "white");
|
||||
for (auto sprite : spriteTexts)
|
||||
{
|
||||
const bool a = sprite->getRect().y + sprite->getRect().h > 0;
|
||||
@@ -600,10 +600,4 @@ void Ending2::updateMusicVolume()
|
||||
const int volume = 128 * step;
|
||||
JA_SetVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
void Ending2::switchPalette()
|
||||
{
|
||||
options.palette = (options.palette == p_zxspectrum) ? p_zxarne : p_zxspectrum;
|
||||
}
|
||||
Reference in New Issue
Block a user