forked from jaildesigner-jailgames/jaildoctors_dilemma
Reestructurant la classe Options
This commit is contained in:
@@ -53,12 +53,12 @@ Demo::Demo()
|
||||
board.lives = 9;
|
||||
board.items = 0;
|
||||
board.rooms = 1;
|
||||
board.jailEnabled = false;
|
||||
board.jail_is_open = false;
|
||||
board.music = true;
|
||||
setScoreBoardColor();
|
||||
|
||||
options.section.name = SECTION_DEMO;
|
||||
options.section.subsection = 0;
|
||||
options.section.section = Section::DEMO;
|
||||
options.section.subsection = Subsection::NONE;
|
||||
}
|
||||
|
||||
Demo::~Demo()
|
||||
@@ -89,7 +89,7 @@ void Demo::checkInput()
|
||||
// Bucle para el juego
|
||||
void Demo::run()
|
||||
{
|
||||
while (options.section.name == SECTION_DEMO)
|
||||
while (options.section.section == Section::DEMO)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
@@ -142,7 +142,7 @@ void Demo::renderRoomName()
|
||||
{
|
||||
// Texto en el centro de la pantalla
|
||||
SDL_Rect rect = {0, 16 * BLOCK, PLAY_AREA_WIDTH, BLOCK * 2};
|
||||
color_t color = stringToColor(options.palette, "white");
|
||||
Color color = stringToColor(options.video.palette, "white");
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
@@ -165,13 +165,13 @@ void Demo::reLoadTextures()
|
||||
void Demo::switchPalette()
|
||||
{
|
||||
// Modifica la variable
|
||||
if (options.palette == p_zxspectrum)
|
||||
if (options.video.palette == Palette::ZXSPECTRUM)
|
||||
{
|
||||
options.palette = p_zxarne;
|
||||
options.video.palette = Palette::ZXARNE;
|
||||
}
|
||||
else
|
||||
{
|
||||
options.palette = p_zxspectrum;
|
||||
options.video.palette = Palette::ZXSPECTRUM;
|
||||
}
|
||||
|
||||
room->reLoadPalette();
|
||||
@@ -215,8 +215,8 @@ void Demo::checkRoomChange()
|
||||
roomIndex++;
|
||||
if (roomIndex == (int)rooms.size())
|
||||
{
|
||||
options.section.name = SECTION_LOGO;
|
||||
options.section.subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
options.section.section = Section::LOGO;
|
||||
options.section.subsection = Subsection::LOGO_TO_TITLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -229,13 +229,13 @@ void Demo::checkRoomChange()
|
||||
void Demo::setScoreBoardColor()
|
||||
{
|
||||
// Obtiene el color del borde
|
||||
const color_t c = room->getBorderColor();
|
||||
const Color color = room->getBorderColor();
|
||||
|
||||
// Si el color es negro lo cambia a blanco
|
||||
const color_t cBlack = stringToColor(options.palette, "black");
|
||||
board.color = colorAreEqual(c, cBlack) ? stringToColor(options.palette, "white") : c;
|
||||
const Color black_color = stringToColor(options.video.palette, "black");
|
||||
board.color = colorAreEqual(color, black_color) ? stringToColor(options.video.palette, "white") : color;
|
||||
|
||||
// Si el color es negro brillante lo cambia a blanco
|
||||
const color_t cBrightBlack = stringToColor(options.palette, "bright_black");
|
||||
board.color = colorAreEqual(c, cBrightBlack) ? stringToColor(options.palette, "white") : c;
|
||||
const Color bright_blac_color = stringToColor(options.video.palette, "bright_black");
|
||||
board.color = colorAreEqual(color, bright_blac_color) ? stringToColor(options.video.palette, "white") : color;
|
||||
}
|
||||
Reference in New Issue
Block a user