Arreglados los cambios de lenguaje

This commit is contained in:
2022-10-06 09:39:39 +02:00
parent f4f7bb52b3
commit 83103ddfea
9 changed files with 268 additions and 21 deletions

View File

@@ -12,9 +12,6 @@ Director::Director(std::string path)
section.name = PROG_SECTION_GAME;
section.subsection = GAME_SECTION_PLAY_1P;
section.name = PROG_SECTION_LOGO;
section.subsection = 0;
// Crea el objeto que controla los ficheros de recursos
asset = new Asset(path.substr(0, path.find_last_of("\\/")) + "/../");

View File

@@ -500,7 +500,11 @@ void Game::loadMedia()
// Menus
gameOverMenu = new Menu(renderer, asset, input, asset->get("gameover.men"));
gameOverMenu->setItemCaption(0, lang->getText(48));
gameOverMenu->setItemCaption(1, lang->getText(49));
pauseMenu = new Menu(renderer, asset, input, asset->get("pause.men"));
pauseMenu->setItemCaption(0, lang->getText(46));
pauseMenu->setItemCaption(1, lang->getText(47));
// Sonidos
balloonSound = JA_LoadSound(asset->get("balloon.wav").c_str());

View File

@@ -46,20 +46,20 @@ bool Lang::setLang(Uint8 lang)
if (rfile.is_open() && rfile.good())
{
success = true;
std::string buffer;
std::string line;
// lee el resto de datos del fichero
int index = 0;
int line_read = 0;
while (std::getline(rfile, buffer))
while (std::getline(rfile, line))
{
// Almacena solo las lineas impares
if (line_read % 2 == 1)
mTextStrings[index++] = buffer;
// Limpia el buffer
buffer.clear();
line_read++;
// Almacena solo las lineas que no empiezan por # o no esten vacias
const bool test1 = line.substr(0,1) != "#";
const bool test2 = !line.empty();
if (test1 && test2)
{
mTextStrings[index] = line;
index++;
}
};
}

View File

@@ -144,7 +144,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
}
// Actualiza los textos de los menus
// updateMenuLabels();
updateMenuLabels();
}
// Destructor
@@ -252,14 +252,10 @@ void Title::update()
JA_PlayMusic(titleMusic);
}
// Actualiza el contador de ticks
ticks = SDL_GetTicks();
dustBitmapR->update();
dustBitmapL->update();
// Actualiza la lógica del titulo
menu.active->update();
fade->update();
if (fade->hasEnded())
@@ -306,7 +302,7 @@ void Title::update()
// Comprueba las entradas para el menu
if (menuVisible == true)
{
menu.active->checkInput();
menu.active->update();
}
// Comprueba si se ha seleccionado algún item del menú
@@ -318,14 +314,17 @@ void Title::update()
postFade = 0;
fade->activateFade();
break;
case 1: // 2 PLAYERS
postFade = 1;
fade->activateFade();
break;
case 2: // OPTIONS
menu.active = menu.options;
optionsPrevious = *options;
break;
case 3: // QUIT
postFade = 2;
fade->activateFade();
@@ -350,20 +349,24 @@ void Title::update()
options->difficulty = DIFFICULTY_EASY;
updateMenuLabels();
break;
case 1: // PLAYER 1 CONTROLS
updatePlayerInputs(0);
updateMenuLabels();
break;
case 3: // PLAYER 2 CONTROLS
updatePlayerInputs(1);
updateMenuLabels();
break;
case 5: // Language
options->language++;
if (options->language == 3)
options->language = 0;
updateMenuLabels();
break;
case 6: // Display mode
switchFullScreenModeVar();
if (options->fullScreenMode != 0)
@@ -378,12 +381,14 @@ void Title::update()
}
updateMenuLabels();
break;
case 8: // Windows size
options->windowSize++;
if (options->windowSize == 5)
options->windowSize = 1;
updateMenuLabels();
break;
case 9: // FILTER
if (options->filter == FILTER_LINEAL)
options->filter = FILTER_NEAREST;
@@ -391,6 +396,7 @@ void Title::update()
options->filter = FILTER_LINEAL;
updateMenuLabels();
break;
case 10: // VSYNC
if (options->vSync)
options->vSync = false;
@@ -398,14 +404,17 @@ void Title::update()
options->vSync = true;
updateMenuLabels();
break;
case 11: // HOW TO PLAY
runInstructions(INSTRUCTIONS_MODE_MANUAL);
break;
case 12: // ACCEPT
applyOptions();
menu.active->reset();
menu.active = menu.title;
break;
case 13: // CANCEL
options = &optionsPrevious;
updateMenuLabels();