desacoplament de Player i Options

Player: canviat id de int a enum
migrant input: eliminat Device, keyboard separat de la llista de mandos, llig i guarda configuracions de mandos
falta: definir botons, asignar mandos a jugadors i guardar la asignació
This commit is contained in:
2025-08-03 22:49:28 +02:00
parent de9fb5aa4b
commit 90c080f3e3
19 changed files with 433 additions and 353 deletions

View File

@@ -102,7 +102,7 @@ void Director::init() {
auto gamepads = Input::get()->getGamepads();
if (!gamepads.empty())
Options::controllers.front().gamepad = gamepads.front();
Options::gamepads.front()->instance = gamepads.front();
ServiceMenu::init(); // Inicializa el menú de servicio
Notifier::init(std::string(), Resource::get()->getText("8bithud")); // Inicialización del sistema de notificaciones
@@ -543,23 +543,19 @@ void Director::runTitle() {
// Ejecuta la sección donde se juega al juego
void Director::runGame() {
int player_id = 1;
Player::Id player_id = Player::Id::PLAYER1;
switch (Section::options) {
case Section::Options::GAME_PLAY_1P:
player_id = 1;
player_id = Player::Id::PLAYER1;
break;
case Section::Options::GAME_PLAY_2P:
player_id = 2;
player_id = Player::Id::PLAYER2;
break;
case Section::Options::GAME_PLAY_BOTH:
player_id = 0;
player_id = Player::Id::BOTH_PLAYERS;
break;
default:
player_id = 1;
break;
}
@@ -568,7 +564,7 @@ void Director::runGame() {
#else
constexpr int CURRENT_STAGE = 0;
#endif
auto game = std::make_unique<Game>(player_id, CURRENT_STAGE, GAME_MODE_DEMO_OFF);
auto game = std::make_unique<Game>(player_id, CURRENT_STAGE, Game::DEMO_OFF);
game->run();
}
@@ -592,9 +588,9 @@ void Director::runHiScoreTable() {
// Ejecuta el juego en modo demo
void Director::runDemoGame() {
const auto PLAYER_ID = (rand() % 2) + 1;
const auto PLAYER_ID = static_cast<Player::Id>((rand() % 2) + 1);
constexpr auto CURRENT_STAGE = 0;
auto game = std::make_unique<Game>(PLAYER_ID, CURRENT_STAGE, GAME_MODE_DEMO_ON);
auto game = std::make_unique<Game>(PLAYER_ID, CURRENT_STAGE, Game::DEMO_ON);
game->run();
}