Compare commits
5 Commits
333c905b1a
...
a00c2284b6
| Author | SHA1 | Date | |
|---|---|---|---|
| a00c2284b6 | |||
| 75f9d3f5cb | |||
| 85a082d738 | |||
| b6c5d06246 | |||
| 891d5a8f5e |
@@ -150,6 +150,26 @@ void Notify::clearFinishedNotifications()
|
|||||||
// Muestra una notificación de texto por pantalla;
|
// Muestra una notificación de texto por pantalla;
|
||||||
void Notify::showText(std::string text1, std::string text2, int icon)
|
void Notify::showText(std::string text1, std::string text2, int icon)
|
||||||
{
|
{
|
||||||
|
// Cuenta el número de textos a mostrar
|
||||||
|
int numTexts = 0;
|
||||||
|
if (text1 != "")
|
||||||
|
numTexts++;
|
||||||
|
if (text2 != "")
|
||||||
|
numTexts++;
|
||||||
|
|
||||||
|
// Si no hay texto, acaba
|
||||||
|
if (numTexts == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Si solo hay un texto, lo coloca en la primera variable
|
||||||
|
else if (numTexts == 1)
|
||||||
|
{
|
||||||
|
text1 = text1 + text2;
|
||||||
|
text2 = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si las notificaciones no se apilan, elimina las anteriores
|
||||||
if (!stack)
|
if (!stack)
|
||||||
{
|
{
|
||||||
clearNotifications();
|
clearNotifications();
|
||||||
@@ -162,7 +182,6 @@ void Notify::showText(std::string text1, std::string text2, int icon)
|
|||||||
const int iconSpace = icon >= 0 ? iconSize + paddingIn : 0;
|
const int iconSpace = icon >= 0 ? iconSize + paddingIn : 0;
|
||||||
const std::string txt = text1.length() > text2.length() ? text1 : text2;
|
const std::string txt = text1.length() > text2.length() ? text1 : text2;
|
||||||
const int width = text->lenght(txt) + (paddingIn * 2) + iconSpace;
|
const int width = text->lenght(txt) + (paddingIn * 2) + iconSpace;
|
||||||
const int numTexts = text2 == "" ? 1 : 2;
|
|
||||||
const int height = (text->getCharacterSize() * numTexts) + (paddingIn * 2);
|
const int height = (text->getCharacterSize() * numTexts) + (paddingIn * 2);
|
||||||
const notification_shape_t shape = notification_shape_squared;
|
const notification_shape_t shape = notification_shape_squared;
|
||||||
|
|
||||||
|
|||||||
@@ -353,9 +353,14 @@ void Screen::checkInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba el botón de SERVICE
|
// Comprueba el botón de SERVICE
|
||||||
if (checkServiceButton(input) == SERVICE_SHADERS)
|
switch (checkServiceButton(input))
|
||||||
{
|
{
|
||||||
|
case SERVICE_SHADERS:
|
||||||
switchShaders();
|
switchShaders();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,27 +146,19 @@ bool checkCollision(SDL_Point &p, SDL_Rect &r)
|
|||||||
// Convierte una cadena en un valor booleano
|
// Convierte una cadena en un valor booleano
|
||||||
bool stringToBool(std::string str)
|
bool stringToBool(std::string str)
|
||||||
{
|
{
|
||||||
if (str == "true")
|
return str == "true" ? true : false;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convierte un valor booleano en una cadena
|
// Convierte un valor booleano en una cadena
|
||||||
std::string boolToString(bool value)
|
std::string boolToString(bool value)
|
||||||
{
|
{
|
||||||
if (value)
|
return value == true ? "true" : "false";
|
||||||
{
|
}
|
||||||
return "true";
|
|
||||||
}
|
// Convierte un valor booleano en una cadena "on" o "off"
|
||||||
else
|
std::string boolToOnOff(bool value)
|
||||||
{
|
{
|
||||||
return "false";
|
return value == true ? "on" : "off";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convierte una cadena a minusculas
|
// Convierte una cadena a minusculas
|
||||||
@@ -225,40 +217,40 @@ hiScoreEntry_t sortHiScoreTable(hiScoreEntry_t entry1, hiScoreEntry_t entry2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dibuja un circulo
|
// Dibuja un circulo
|
||||||
void DrawCircle(SDL_Renderer * renderer, int32_t centerX, int32_t centerY, int32_t radius)
|
void DrawCircle(SDL_Renderer *renderer, int32_t centerX, int32_t centerY, int32_t radius)
|
||||||
{
|
{
|
||||||
const int32_t diameter = (radius * 2);
|
const int32_t diameter = (radius * 2);
|
||||||
|
|
||||||
int32_t x = (radius - 1);
|
int32_t x = (radius - 1);
|
||||||
int32_t y = 0;
|
int32_t y = 0;
|
||||||
int32_t tx = 1;
|
int32_t tx = 1;
|
||||||
int32_t ty = 1;
|
int32_t ty = 1;
|
||||||
int32_t error = (tx - diameter);
|
int32_t error = (tx - diameter);
|
||||||
|
|
||||||
while (x >= y)
|
while (x >= y)
|
||||||
{
|
{
|
||||||
// Each of the following renders an octant of the circle
|
// Each of the following renders an octant of the circle
|
||||||
SDL_RenderDrawPoint(renderer, centerX + x, centerY - y);
|
SDL_RenderDrawPoint(renderer, centerX + x, centerY - y);
|
||||||
SDL_RenderDrawPoint(renderer, centerX + x, centerY + y);
|
SDL_RenderDrawPoint(renderer, centerX + x, centerY + y);
|
||||||
SDL_RenderDrawPoint(renderer, centerX - x, centerY - y);
|
SDL_RenderDrawPoint(renderer, centerX - x, centerY - y);
|
||||||
SDL_RenderDrawPoint(renderer, centerX - x, centerY + y);
|
SDL_RenderDrawPoint(renderer, centerX - x, centerY + y);
|
||||||
SDL_RenderDrawPoint(renderer, centerX + y, centerY - x);
|
SDL_RenderDrawPoint(renderer, centerX + y, centerY - x);
|
||||||
SDL_RenderDrawPoint(renderer, centerX + y, centerY + x);
|
SDL_RenderDrawPoint(renderer, centerX + y, centerY + x);
|
||||||
SDL_RenderDrawPoint(renderer, centerX - y, centerY - x);
|
SDL_RenderDrawPoint(renderer, centerX - y, centerY - x);
|
||||||
SDL_RenderDrawPoint(renderer, centerX - y, centerY + x);
|
SDL_RenderDrawPoint(renderer, centerX - y, centerY + x);
|
||||||
|
|
||||||
if (error <= 0)
|
if (error <= 0)
|
||||||
{
|
{
|
||||||
++y;
|
++y;
|
||||||
error += ty;
|
error += ty;
|
||||||
ty += 2;
|
ty += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error > 0)
|
if (error > 0)
|
||||||
{
|
{
|
||||||
--x;
|
--x;
|
||||||
tx += 2;
|
tx += 2;
|
||||||
error += (tx - diameter);
|
error += (tx - diameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,6 +272,9 @@ bool stringToBool(std::string str);
|
|||||||
// Convierte un valor booleano en una cadena
|
// Convierte un valor booleano en una cadena
|
||||||
std::string boolToString(bool value);
|
std::string boolToString(bool value);
|
||||||
|
|
||||||
|
// Convierte un valor booleano en una cadena "on" o "off"
|
||||||
|
std::string boolToOnOff(bool value);
|
||||||
|
|
||||||
// Convierte una cadena a minusculas
|
// Convierte una cadena a minusculas
|
||||||
std::string toLower(std::string str);
|
std::string toLower(std::string str);
|
||||||
|
|
||||||
|
|||||||
@@ -2050,35 +2050,24 @@ void Game::checkInput()
|
|||||||
switch (checkServiceButton(input))
|
switch (checkServiceButton(input))
|
||||||
{
|
{
|
||||||
case SERVICE_RESET:
|
case SERVICE_RESET:
|
||||||
{
|
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_LOGO;
|
||||||
screen->showNotification("Reset");
|
screen->showNotification("Reset");
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_MUTE:
|
case SERVICE_MUTE:
|
||||||
{
|
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
|
||||||
const bool value = !options->audio.music.enabled;
|
JA_EnableMusic(options->audio.music.enabled);
|
||||||
options->audio.music.enabled = value;
|
JA_EnableSound(options->audio.sound.enabled);
|
||||||
options->audio.sound.enabled = value;
|
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
|
||||||
JA_EnableMusic(value);
|
|
||||||
JA_EnableSound(value);
|
|
||||||
const std::string text = value ? "on" : "off";
|
|
||||||
screen->showNotification("Audio " + text);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_PAUSE:
|
case SERVICE_PAUSE:
|
||||||
{
|
|
||||||
pause(!paused);
|
pause(!paused);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Modo Demo activo
|
// Modo Demo activo
|
||||||
if (demo.enabled)
|
if (demo.enabled)
|
||||||
|
|||||||
@@ -212,29 +212,20 @@ void HiScoreTable::checkInput()
|
|||||||
switch (checkServiceButton(input))
|
switch (checkServiceButton(input))
|
||||||
{
|
{
|
||||||
case SERVICE_RESET:
|
case SERVICE_RESET:
|
||||||
{
|
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_LOGO;
|
||||||
screen->showNotification("Reset");
|
screen->showNotification("Reset");
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_MUTE:
|
case SERVICE_MUTE:
|
||||||
{
|
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
|
||||||
const bool value = !options->audio.music.enabled;
|
JA_EnableMusic(options->audio.music.enabled);
|
||||||
options->audio.music.enabled = value;
|
JA_EnableSound(options->audio.sound.enabled);
|
||||||
options->audio.sound.enabled = value;
|
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
|
||||||
JA_EnableMusic(value);
|
|
||||||
JA_EnableSound(value);
|
|
||||||
const std::string text = value ? "on" : "off";
|
|
||||||
screen->showNotification("Audio " + text);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
|
|||||||
@@ -342,29 +342,20 @@ void Instructions::checkInput()
|
|||||||
switch (checkServiceButton(input))
|
switch (checkServiceButton(input))
|
||||||
{
|
{
|
||||||
case SERVICE_RESET:
|
case SERVICE_RESET:
|
||||||
{
|
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_LOGO;
|
||||||
screen->showNotification("Reset");
|
screen->showNotification("Reset");
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_MUTE:
|
case SERVICE_MUTE:
|
||||||
{
|
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
|
||||||
const bool value = !options->audio.music.enabled;
|
JA_EnableMusic(options->audio.music.enabled);
|
||||||
options->audio.music.enabled = value;
|
JA_EnableSound(options->audio.sound.enabled);
|
||||||
options->audio.sound.enabled = value;
|
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
|
||||||
JA_EnableMusic(value);
|
|
||||||
JA_EnableSound(value);
|
|
||||||
const std::string text = value ? "on" : "off";
|
|
||||||
screen->showNotification("Audio " + text);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
|
|||||||
@@ -211,29 +211,20 @@ void Intro::checkInput()
|
|||||||
switch (checkServiceButton(input))
|
switch (checkServiceButton(input))
|
||||||
{
|
{
|
||||||
case SERVICE_RESET:
|
case SERVICE_RESET:
|
||||||
{
|
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_LOGO;
|
||||||
screen->showNotification("Reset");
|
screen->showNotification("Reset");
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_MUTE:
|
case SERVICE_MUTE:
|
||||||
{
|
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
|
||||||
const bool value = !options->audio.music.enabled;
|
JA_EnableMusic(options->audio.music.enabled);
|
||||||
options->audio.music.enabled = value;
|
JA_EnableSound(options->audio.sound.enabled);
|
||||||
options->audio.sound.enabled = value;
|
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
|
||||||
JA_EnableMusic(value);
|
|
||||||
JA_EnableSound(value);
|
|
||||||
const std::string text = value ? "on" : "off";
|
|
||||||
screen->showNotification("Audio " + text);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
|
|||||||
@@ -122,37 +122,21 @@ void Logo::checkInput()
|
|||||||
switch (checkServiceButton(input))
|
switch (checkServiceButton(input))
|
||||||
{
|
{
|
||||||
case SERVICE_EXIT:
|
case SERVICE_EXIT:
|
||||||
{
|
|
||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
section->options = SECTION_OPTIONS_QUIT_SHUTDOWN;
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_RESET:
|
|
||||||
{
|
|
||||||
section->name = SECTION_PROG_LOGO;
|
|
||||||
screen->showNotification("Reset");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_MUTE:
|
case SERVICE_MUTE:
|
||||||
{
|
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
|
||||||
const bool value = !options->audio.music.enabled;
|
JA_EnableMusic(options->audio.music.enabled);
|
||||||
options->audio.music.enabled = value;
|
JA_EnableSound(options->audio.sound.enabled);
|
||||||
options->audio.sound.enabled = value;
|
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
|
||||||
JA_EnableMusic(value);
|
|
||||||
JA_EnableSound(value);
|
|
||||||
const std::string text = value ? "on" : "off";
|
|
||||||
screen->showNotification("Audio " + text);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba el input para el resto de objetos
|
// Comprueba el input para el resto de objetos
|
||||||
screen->checkInput();
|
screen->checkInput();
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ int checkServiceButton(Input *input, int index)
|
|||||||
|
|
||||||
else if (input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
else if (input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
return SERVICE_CONFIG;
|
return SERVICE_SHADERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
else if (input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
return SERVICE_SHADERS;
|
return SERVICE_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
else if (input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
@@ -36,7 +36,7 @@ int checkServiceButton(Input *input, int index)
|
|||||||
|
|
||||||
else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
{
|
{
|
||||||
return SERVICE_RESET;
|
return SERVICE_CONFIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
|
||||||
@@ -57,12 +57,12 @@ int checkServiceButton(Input *input, int index)
|
|||||||
|
|
||||||
else if (input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
else if (input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
return SERVICE_CONFIG;
|
return SERVICE_SHADERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
else if (input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
return SERVICE_SHADERS;
|
return SERVICE_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
else if (input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
||||||
@@ -77,7 +77,7 @@ int checkServiceButton(Input *input, int index)
|
|||||||
|
|
||||||
else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
||||||
{
|
{
|
||||||
return SERVICE_RESET;
|
return SERVICE_CONFIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index))
|
||||||
|
|||||||
@@ -271,35 +271,24 @@ void Title::checkInput()
|
|||||||
switch (checkServiceButton(input))
|
switch (checkServiceButton(input))
|
||||||
{
|
{
|
||||||
case SERVICE_RESET:
|
case SERVICE_RESET:
|
||||||
{
|
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_LOGO;
|
||||||
screen->showNotification("Reset");
|
screen->showNotification("Reset");
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_MUTE:
|
case SERVICE_MUTE:
|
||||||
{
|
options->audio.sound.enabled = options->audio.music.enabled = !options->audio.music.enabled;
|
||||||
const bool value = !options->audio.music.enabled;
|
JA_EnableMusic(options->audio.music.enabled);
|
||||||
options->audio.music.enabled = value;
|
JA_EnableSound(options->audio.sound.enabled);
|
||||||
options->audio.sound.enabled = value;
|
screen->showNotification("Audio " + boolToOnOff(options->audio.music.enabled));
|
||||||
JA_EnableMusic(value);
|
|
||||||
JA_EnableSound(value);
|
|
||||||
const std::string text = value ? "on" : "off";
|
|
||||||
screen->showNotification("Audio " + text);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case SERVICE_SWAP_CONTROLLERS:
|
case SERVICE_SWAP_CONTROLLERS:
|
||||||
{
|
|
||||||
swapControllers();
|
swapControllers();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba si algun mando quiere ser configurado
|
// Comprueba si algun mando quiere ser configurado
|
||||||
for (int i = 0; i < input->getNumControllers(); ++i)
|
for (int i = 0; i < input->getNumControllers(); ++i)
|
||||||
@@ -365,17 +354,27 @@ void Title::swapControllers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
defineButtons->swapControllers();
|
defineButtons->swapControllers();
|
||||||
const std::string text0 = "Jugador " + std::to_string(options->controller[0].playerId) + " -> " + options->controller[0].name;
|
|
||||||
const std::string text1 = "Jugador " + std::to_string(options->controller[1].playerId) + " -> " + options->controller[1].name;
|
|
||||||
|
|
||||||
if (numControllers == 1)
|
// Crea cadenas de texto vacias para un numero máximo de mandos
|
||||||
|
const int MAX_CONTROLLERS = 2;
|
||||||
|
std::string text[MAX_CONTROLLERS];
|
||||||
|
for (int i = 0; i < MAX_CONTROLLERS; ++i)
|
||||||
|
text[i] = "";
|
||||||
|
|
||||||
|
// Obtiene para cada jugador el índice del mando correspondiente
|
||||||
|
int playerControllerIndex[numControllers];
|
||||||
|
for (int i = 0; i < numControllers; ++i)
|
||||||
{
|
{
|
||||||
screen->showNotification(text0);
|
playerControllerIndex[options->controller[i].playerId - 1] = i;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// Genera el texto correspondiente
|
||||||
|
for (int i = 0; i < numControllers; ++i)
|
||||||
{
|
{
|
||||||
screen->showNotification(text0, text1);
|
text[i] = "Jugador " + std::to_string(i + 1) + ": " + options->controller[playerControllerIndex[i]].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
screen->showNotification(text[0], text[1]);
|
||||||
|
|
||||||
resetCounter();
|
resetCounter();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user