Apanyats alguns bugs que quedaven respecte a lo del teclat

This commit is contained in:
2024-11-03 17:25:31 +01:00
parent 86cd7b0f16
commit 69a92cba66
6 changed files with 27 additions and 14 deletions

View File

@@ -206,7 +206,7 @@ NORMAL
DIFICIL DIFICIL
## 69 - MENU DE OPCIONES ## 69 - MENU DE OPCIONES
TECLAT Teclat
## 70 - MENU DE OPCIONES ## 70 - MENU DE OPCIONES
MANDO MANDO

View File

@@ -206,7 +206,7 @@ NORMAL
HARD HARD
## 69 - MENU DE OPCIONES ## 69 - MENU DE OPCIONES
KEYBOARD Keyboard
## 70 - MENU DE OPCIONES ## 70 - MENU DE OPCIONES
GAME CONTROLLER GAME CONTROLLER

View File

@@ -206,7 +206,7 @@ NORMAL
DIFICIL DIFICIL
## 69 - MENU DE OPCIONES ## 69 - MENU DE OPCIONES
TECLADO Teclado
## 70 - MENU DE OPCIONES ## 70 - MENU DE OPCIONES
MANDO MANDO

View File

@@ -233,6 +233,12 @@ void Director::bindInputs()
options.controllers.at(i).buttons.at(j) = Input::get()->getControllerBinding(i, options.controllers.at(i).inputs.at(j)); options.controllers.at(i).buttons.at(j) = Input::get()->getControllerBinding(i, options.controllers.at(i).inputs.at(j));
} }
} }
// Asegura que algún jugador tenga el teclado asignado
if (getPlayerWhoUsesKeyboard() == 0)
{
setKeyboardToPlayer(1);
}
} }
// Inicializa JailAudio // Inicializa JailAudio

View File

@@ -166,17 +166,21 @@ bool saveOptionsFile(std::string file_path)
// Opciones de mandos // Opciones de mandos
file << "\n\n## CONTROLLERS\n"; file << "\n\n## CONTROLLERS\n";
int controller_index = 0;
for (const auto &controller : options.controllers) for (const auto &controller : options.controllers)
{ {
file << "\n"; file << "\n";
file << "controller." << controller.index << ".name=" << controller.name << "\n"; file << "controller." << controller_index << ".name=" << controller.name << "\n";
file << "controller." << controller.index << ".player=" << controller.player_id << "\n"; file << "controller." << controller_index << ".player=" << controller.player_id << "\n";
file << "controller." << controller.index << ".type=" << static_cast<int>(controller.type) << "\n"; file << "controller." << controller_index << ".type=" << static_cast<int>(controller.type) << "\n";
file << "controller." << controller.index << ".button.fire_left=" << controller.buttons.at(0) << "\n"; file << "controller." << controller_index << ".button.fire_left=" << controller.buttons.at(0) << "\n";
file << "controller." << controller.index << ".button.fire_center=" << controller.buttons.at(1) << "\n"; file << "controller." << controller_index << ".button.fire_center=" << controller.buttons.at(1) << "\n";
file << "controller." << controller.index << ".button.fire_right=" << controller.buttons.at(2) << "\n"; file << "controller." << controller_index << ".button.fire_right=" << controller.buttons.at(2) << "\n";
file << "controller." << controller.index << ".button.start=" << controller.buttons.at(3) << "\n"; file << "controller." << controller_index << ".button.start=" << controller.buttons.at(3) << "\n";
file << "controller." << controller.index << ".button.service=" << controller.buttons.at(4) << "\n"; file << "controller." << controller_index << ".button.service=" << controller.buttons.at(4) << "\n";
// Incrementa el índice
++controller_index;
} }
// Cierra el fichero // Cierra el fichero

View File

@@ -213,16 +213,19 @@ void Title::checkEvents()
case SDLK_3: // Intercambia los mandos entre los dos jugadores case SDLK_3: // Intercambia los mandos entre los dos jugadores
{ {
swapControllers(); swapControllers();
resetCounter();
break; break;
} }
case SDLK_4: // Muestra la asignacion de mandos case SDLK_4: // Muestra la asignacion de mandos
{ {
showControllers(); showControllers();
resetCounter();
break; break;
} }
case SDLK_5: // Intercambia la asignación del teclado case SDLK_5: // Intercambia la asignación del teclado
{ {
swapKeyboard(); swapKeyboard();
resetCounter();
break; break;
} }
default: default:
@@ -311,7 +314,8 @@ void Title::swapControllers()
void Title::swapKeyboard() void Title::swapKeyboard()
{ {
swapOptionsKeyboard(); swapOptionsKeyboard();
Notifier::get()->showText("Teclat per al jugador " + std::to_string(getPlayerWhoUsesKeyboard())); std::string text = lang::getText(100) + std::to_string(getPlayerWhoUsesKeyboard()) + ": " + lang::getText(69);
Notifier::get()->showText(text);
} }
// Muestra información sobre los controles y los jugadores // Muestra información sobre los controles y los jugadores
@@ -340,5 +344,4 @@ void Title::showControllers()
} }
Notifier::get()->showText(text.at(0), text.at(1)); Notifier::get()->showText(text.at(0), text.at(1));
resetCounter();
} }