Al intercambiar los mandos de los jugadores se muestra el mando que corresponde a cada jugador
This commit is contained in:
@@ -225,9 +225,7 @@ void Title::checkEvents()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_3:
|
case SDLK_3:
|
||||||
defineButtons->swapControllers();
|
swapControllers();
|
||||||
screen->showNotification("Swap Controllers");
|
|
||||||
resetCounter();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -291,9 +289,7 @@ void Title::checkInput()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SERVICE_SWAP_CONTROLLERS:
|
case SERVICE_SWAP_CONTROLLERS:
|
||||||
defineButtons->swapControllers();
|
swapControllers();
|
||||||
screen->showNotification("Swap Controllers");
|
|
||||||
resetCounter();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -343,3 +339,29 @@ void Title::resetCounter()
|
|||||||
{
|
{
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Intercambia la asignación de mandos a los jugadores
|
||||||
|
void Title::swapControllers()
|
||||||
|
{
|
||||||
|
const int numControllers = input->getNumControllers();
|
||||||
|
|
||||||
|
if (numControllers == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
screen->showNotification(text0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screen->showNotification(text0, text1);
|
||||||
|
}
|
||||||
|
|
||||||
|
resetCounter();
|
||||||
|
}
|
||||||
@@ -97,6 +97,9 @@ private:
|
|||||||
// Reinicia el contador interno
|
// Reinicia el contador interno
|
||||||
void resetCounter();
|
void resetCounter();
|
||||||
|
|
||||||
|
// Intercambia la asignación de mandos a los jugadores
|
||||||
|
void swapControllers();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
||||||
|
|||||||
Reference in New Issue
Block a user