Ya se guardan las asignaciones de los botones en el fichero de configuración
This commit is contained in:
@@ -72,8 +72,6 @@ void DefineButtons::render()
|
||||
text->writeCentered(x, y - 20, "PLAYER " + std::to_string(indexController + 1));
|
||||
text->writeCentered(x, y - 10, controllerNames[indexController]);
|
||||
text->writeCentered(x, y, buttons[indexButton].label);
|
||||
if (indexButton > 0)
|
||||
text->writeCentered(x, y + 10, std::to_string(buttons[indexButton - 1].button));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,8 +121,6 @@ void DefineButtons::enable(int index)
|
||||
enabled = true;
|
||||
indexController = index;
|
||||
indexButton = 0;
|
||||
|
||||
input->printBindings(INPUT_USE_GAMECONTROLLER, indexController);
|
||||
}
|
||||
|
||||
// Comprueba si está habilitado
|
||||
@@ -143,11 +139,24 @@ void DefineButtons::incIndexButton()
|
||||
{
|
||||
// Asigna los botones definidos al input
|
||||
bindButtons();
|
||||
input->printBindings(INPUT_USE_GAMECONTROLLER, indexController);
|
||||
|
||||
// Guarda los cambios en las opciones
|
||||
saveBindingsToOptions();
|
||||
|
||||
// Reinicia variables
|
||||
indexButton = 0;
|
||||
indexController = 0;
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Guarda los cambios en las opciones
|
||||
void DefineButtons::saveBindingsToOptions()
|
||||
{
|
||||
// Modifica las opciones para colocar los valores asignados
|
||||
options->controller[indexController].name = input->getControllerName(indexController);
|
||||
for (int j = 0; j < (int)options->controller[indexController].inputs.size(); ++j)
|
||||
{
|
||||
options->controller[indexController].buttons[j] = input->getControllerBinding(indexController, options->controller[indexController].inputs[j]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user