Demana confirmació per a canviar el idioma amb les tecles ràpides
Demana confirmació per reiniciar
This commit is contained in:
@@ -371,4 +371,13 @@ GRAFICS DIBUIXATS PER
|
|||||||
MUSICA COMPOSADA PER
|
MUSICA COMPOSADA PER
|
||||||
|
|
||||||
## 124 - CREDITS
|
## 124 - CREDITS
|
||||||
EFECTES DE SO
|
EFECTES DE SO
|
||||||
|
|
||||||
|
## 125 - NOTIFICACIONES
|
||||||
|
Torna a polsar per reiniciar
|
||||||
|
|
||||||
|
## 126 - NOTIFICACIONES
|
||||||
|
Torna a polsar per canviar el idioma a
|
||||||
|
|
||||||
|
## 127 - NOTIFICACIONES
|
||||||
|
Idioma canviat a
|
||||||
@@ -371,4 +371,13 @@ PIXELART DRAWN BY
|
|||||||
MUSIC COMPOSED BY
|
MUSIC COMPOSED BY
|
||||||
|
|
||||||
## 124 - CREDITS
|
## 124 - CREDITS
|
||||||
SOUND EFFECTS
|
SOUND EFFECTS
|
||||||
|
|
||||||
|
## 125 - NOTIFICACIONES
|
||||||
|
Press again to reset
|
||||||
|
|
||||||
|
## 126 - NOTIFICACIONES
|
||||||
|
Press again to change languaje to
|
||||||
|
|
||||||
|
## 127 - NOTIFICACIONES
|
||||||
|
Language set to
|
||||||
@@ -371,4 +371,13 @@ GRAFICOS DIBUJADOS POR
|
|||||||
MUSICA COMPUESTA POR
|
MUSICA COMPUESTA POR
|
||||||
|
|
||||||
## 124 - CREDITS
|
## 124 - CREDITS
|
||||||
EFECTOS DE SONIDO
|
EFECTOS DE SONIDO
|
||||||
|
|
||||||
|
## 125 - NOTIFICACIONES
|
||||||
|
Vuelve a pulsar para reiniciar
|
||||||
|
|
||||||
|
## 126 - NOTIFICACIONES
|
||||||
|
Vuelve a pulsar para cambiar el idioma a
|
||||||
|
|
||||||
|
## 127 - NOTIFICACIONES
|
||||||
|
Idioma cambiado a
|
||||||
@@ -1268,9 +1268,11 @@ void Game::checkEvents()
|
|||||||
case SDLK_3: // Activa el modo para pasar el juego automaticamente
|
case SDLK_3: // Activa el modo para pasar el juego automaticamente
|
||||||
{
|
{
|
||||||
auto_pop_balloons_ = !auto_pop_balloons_;
|
auto_pop_balloons_ = !auto_pop_balloons_;
|
||||||
Notifier::get()->showText({"auto advance: " + boolToString(auto_pop_balloons_)});
|
Notifier::get()->show({"auto advance: " + boolToString(auto_pop_balloons_)});
|
||||||
if (auto_pop_balloons_)
|
if (auto_pop_balloons_)
|
||||||
|
{
|
||||||
balloon_manager_->destroyAllBalloons();
|
balloon_manager_->destroyAllBalloons();
|
||||||
|
}
|
||||||
balloon_manager_->setDeployBalloons(!auto_pop_balloons_);
|
balloon_manager_->setDeployBalloons(!auto_pop_balloons_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ namespace globalInputs
|
|||||||
// Termina
|
// Termina
|
||||||
void quit(section::Options code)
|
void quit(section::Options code)
|
||||||
{
|
{
|
||||||
const std::string exit_code = "QUIT";
|
const std::string CODE = "QUIT";
|
||||||
auto code_found = stringInVector(Notifier::get()->getCodes(), exit_code);
|
if (Notifier::get()->checkCode(CODE))
|
||||||
if (code_found)
|
|
||||||
{
|
{
|
||||||
// Si la notificación de salir está activa, cambia de sección
|
// Si la notificación de salir está activa, cambia de sección
|
||||||
section::name = section::Name::QUIT;
|
section::name = section::Name::QUIT;
|
||||||
@@ -33,10 +32,10 @@ namespace globalInputs
|
|||||||
{
|
{
|
||||||
// Si la notificación de salir no está activa, muestra la notificación
|
// Si la notificación de salir no está activa, muestra la notificación
|
||||||
#ifdef ARCADE
|
#ifdef ARCADE
|
||||||
const int index = code == section::Options::QUIT_WITH_CONTROLLER ? 116 : 94;
|
const int INDEX = code == section::Options::QUIT_WITH_CONTROLLER ? 116 : 94;
|
||||||
Notifier::get()->showText({lang::getText(index), std::string()}, -1, exit_code);
|
Notifier::get()->showText({lang::getText(INDEX), std::string()}, -1, CODE);
|
||||||
#else
|
#else
|
||||||
Notifier::get()->showText({lang::getText(94), std::string()}, -1, exit_code);
|
Notifier::get()->show({lang::getText(94), std::string()}, -1, CODE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,8 +43,16 @@ namespace globalInputs
|
|||||||
// Reinicia
|
// Reinicia
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
section::name = section::Name::INIT;
|
const std::string CODE = "RESET";
|
||||||
Notifier::get()->showText({"Reset"});
|
if (Notifier::get()->checkCode(CODE))
|
||||||
|
{
|
||||||
|
section::name = section::Name::INIT;
|
||||||
|
Notifier::get()->show({"Reset"});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Notifier::get()->show({lang::getText(125), std::string()}, -1, CODE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activa o desactiva el audio
|
// Activa o desactiva el audio
|
||||||
@@ -62,7 +69,7 @@ namespace globalInputs
|
|||||||
JA_SetMusicVolume(0);
|
JA_SetMusicVolume(0);
|
||||||
JA_SetSoundVolume(0);
|
JA_SetSoundVolume(0);
|
||||||
}
|
}
|
||||||
Notifier::get()->showText({"Audio " + boolToOnOff(options.audio.enabled)});
|
Notifier::get()->show({"Audio " + boolToOnOff(options.audio.enabled)});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene una fichero a partir de un lang::Code
|
// Obtiene una fichero a partir de un lang::Code
|
||||||
@@ -88,13 +95,13 @@ namespace globalInputs
|
|||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case lang::Code::ba_BA:
|
case lang::Code::ba_BA:
|
||||||
return "ba_BA";
|
return " \"ba_BA\"";
|
||||||
break;
|
break;
|
||||||
case lang::Code::es_ES:
|
case lang::Code::es_ES:
|
||||||
return "es_ES";
|
return " \"es_ES\"";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return "en_UK";
|
return " \"en_UK\"";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,18 +109,27 @@ namespace globalInputs
|
|||||||
// Cambia el idioma
|
// Cambia el idioma
|
||||||
void changeLang()
|
void changeLang()
|
||||||
{
|
{
|
||||||
options.game.language = lang::change(options.game.language);
|
const std::string CODE = "LANG";
|
||||||
lang::loadFromFile(getLangFile(static_cast<lang::Code>(options.game.language)));
|
if (Notifier::get()->checkCode(CODE))
|
||||||
section::name = section::Name::INIT;
|
{
|
||||||
section::options = section::Options::RELOAD;
|
options.game.language = lang::getNextLangCode(options.game.language);
|
||||||
Notifier::get()->showText({getLangName(options.game.language)});
|
lang::loadFromFile(getLangFile(static_cast<lang::Code>(options.game.language)));
|
||||||
|
section::name = section::Name::INIT;
|
||||||
|
section::options = section::Options::RELOAD;
|
||||||
|
Notifier::get()->show({lang::getText(127) + getLangName(options.game.language)});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto NEXT = lang::getNextLangCode(options.game.language);
|
||||||
|
Notifier::get()->show({lang::getText(126) + getLangName(NEXT), std::string()}, -1, CODE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia el modo de disparo
|
// Cambia el modo de disparo
|
||||||
void toggleFireMode()
|
void toggleFireMode()
|
||||||
{
|
{
|
||||||
options.game.autofire = !options.game.autofire;
|
options.game.autofire = !options.game.autofire;
|
||||||
Notifier::get()->showText({"Autofire " + boolToOnOff(options.game.autofire)});
|
Notifier::get()->show({"Autofire " + boolToOnOff(options.game.autofire)});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||||
@@ -127,7 +143,7 @@ namespace globalInputs
|
|||||||
{
|
{
|
||||||
Screen::get()->toggleVideoMode();
|
Screen::get()->toggleVideoMode();
|
||||||
const std::string mode = options.video.mode == ScreenVideoMode::WINDOW ? "Window" : "Fullscreen";
|
const std::string mode = options.video.mode == ScreenVideoMode::WINDOW ? "Window" : "Fullscreen";
|
||||||
Notifier::get()->showText({mode + " mode"});
|
Notifier::get()->show({mode + " mode"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +152,7 @@ namespace globalInputs
|
|||||||
{
|
{
|
||||||
Screen::get()->decWindowSize();
|
Screen::get()->decWindowSize();
|
||||||
const std::string size = std::to_string(options.video.window.size);
|
const std::string size = std::to_string(options.video.window.size);
|
||||||
Notifier::get()->showText({"Window size x" + size});
|
Notifier::get()->show({"Window size x" + size});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +161,7 @@ namespace globalInputs
|
|||||||
{
|
{
|
||||||
Screen::get()->incWindowSize();
|
Screen::get()->incWindowSize();
|
||||||
const std::string size = std::to_string(options.video.window.size);
|
const std::string size = std::to_string(options.video.window.size);
|
||||||
Notifier::get()->showText({"Window size x" + size});
|
Notifier::get()->show({"Window size x" + size});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ namespace lang
|
|||||||
return texts.at(index);
|
return texts.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia el idioma seleccionado al siguiente idioma disponible
|
// Obtiene el codigo del idioma del siguiente idioma
|
||||||
Code change(Code current_lang)
|
Code getNextLangCode(Code lang)
|
||||||
{
|
{
|
||||||
auto index = static_cast<int>(current_lang);
|
auto index = static_cast<int>(lang);
|
||||||
index = (index + 1) % 3;
|
index = (index + 1) % 3;
|
||||||
return static_cast<Code>(index);
|
return static_cast<Code>(index);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ namespace lang
|
|||||||
// Obtiene la cadena de texto del indice
|
// Obtiene la cadena de texto del indice
|
||||||
std::string getText(int index);
|
std::string getText(int index);
|
||||||
|
|
||||||
// Cambia el idioma seleccionado al siguiente idioma disponible
|
// Obtiene el codigo del idioma del siguiente idioma
|
||||||
Code change(Code current_lang);
|
Code getNextLangCode(Code lang);
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ void Notifier::clearFinishedNotifications()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifier::showText(std::vector<std::string> texts, int icon, const std::string &code)
|
void Notifier::show(std::vector<std::string> texts, int icon, const std::string &code)
|
||||||
{
|
{
|
||||||
// Si no hay texto, acaba
|
// Si no hay texto, acaba
|
||||||
if (texts.empty())
|
if (texts.empty())
|
||||||
@@ -164,7 +164,7 @@ void Notifier::showText(std::vector<std::string> texts, int icon, const std::str
|
|||||||
// Si las notificaciones no se apilan, elimina las anteriores
|
// Si las notificaciones no se apilan, elimina las anteriores
|
||||||
if (!stack_)
|
if (!stack_)
|
||||||
{
|
{
|
||||||
clearNotifications();
|
clearAllNotifications();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elimina las cadenas vacías
|
// Elimina las cadenas vacías
|
||||||
@@ -298,7 +298,7 @@ void Notifier::showText(std::vector<std::string> texts, int icon, const std::str
|
|||||||
bool Notifier::isActive() { return !notifications_.empty(); }
|
bool Notifier::isActive() { return !notifications_.empty(); }
|
||||||
|
|
||||||
// Finaliza y elimnina todas las notificaciones activas
|
// Finaliza y elimnina todas las notificaciones activas
|
||||||
void Notifier::clearNotifications()
|
void Notifier::clearAllNotifications()
|
||||||
{
|
{
|
||||||
for (auto ¬ification : notifications_)
|
for (auto ¬ification : notifications_)
|
||||||
{
|
{
|
||||||
@@ -317,4 +317,10 @@ std::vector<std::string> Notifier::getCodes()
|
|||||||
codes.emplace_back(notification.code);
|
codes.emplace_back(notification.code);
|
||||||
}
|
}
|
||||||
return codes;
|
return codes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba si hay alguna notificacion con un código
|
||||||
|
bool Notifier::checkCode(std::string code)
|
||||||
|
{
|
||||||
|
return stringInVector(getCodes(), code);
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ private:
|
|||||||
void clearFinishedNotifications();
|
void clearFinishedNotifications();
|
||||||
|
|
||||||
// Finaliza y elimnina todas las notificaciones activas
|
// Finaliza y elimnina todas las notificaciones activas
|
||||||
void clearNotifications();
|
void clearAllNotifications();
|
||||||
|
|
||||||
// [SINGLETON] Ahora el constructor y el destructor son privados, para no poder crear objetos notifier desde fuera
|
// [SINGLETON] Ahora el constructor y el destructor son privados, para no poder crear objetos notifier desde fuera
|
||||||
|
|
||||||
@@ -93,11 +93,14 @@ public:
|
|||||||
void update();
|
void update();
|
||||||
|
|
||||||
// Muestra una notificación de texto por pantalla
|
// Muestra una notificación de texto por pantalla
|
||||||
void showText(std::vector<std::string> texts, int icon = -1, const std::string &code = std::string());
|
void show(std::vector<std::string> texts, int icon = -1, const std::string &code = std::string());
|
||||||
|
|
||||||
// Indica si hay notificaciones activas
|
// Indica si hay notificaciones activas
|
||||||
bool isActive();
|
bool isActive();
|
||||||
|
|
||||||
// Obtiene los códigos de las notificaciones
|
// Obtiene los códigos de las notificaciones
|
||||||
std::vector<std::string> getCodes();
|
std::vector<std::string> getCodes();
|
||||||
|
|
||||||
|
// Comprueba si hay alguna notificacion con un código
|
||||||
|
bool checkCode(std::string code);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ void Screen::toggleShaders()
|
|||||||
options.video.shaders = !options.video.shaders;
|
options.video.shaders = !options.video.shaders;
|
||||||
setVideoMode(options.video.mode);
|
setVideoMode(options.video.mode);
|
||||||
const std::string value = options.video.shaders ? "on" : "off";
|
const std::string value = options.video.shaders ? "on" : "off";
|
||||||
Notifier::get()->showText({"Shaders " + value});
|
Notifier::get()->show({"Shaders " + value});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activa / desactiva la información de debug
|
// Activa / desactiva la información de debug
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ void Title::swapKeyboard()
|
|||||||
{
|
{
|
||||||
swapOptionsKeyboard();
|
swapOptionsKeyboard();
|
||||||
std::string text = lang::getText(100) + std::to_string(getPlayerWhoUsesKeyboard()) + ": " + lang::getText(69);
|
std::string text = lang::getText(100) + std::to_string(getPlayerWhoUsesKeyboard()) + ": " + lang::getText(69);
|
||||||
Notifier::get()->showText({text});
|
Notifier::get()->show({text});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Muestra información sobre los controles y los jugadores
|
// Muestra información sobre los controles y los jugadores
|
||||||
@@ -404,5 +404,5 @@ void Title::showControllers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Muestra la notificación
|
// Muestra la notificación
|
||||||
Notifier::get()->showText({text.at(0), text.at(1)});
|
Notifier::get()->show({text.at(0), text.at(1)});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user