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:
@@ -19,8 +19,9 @@ DefineButtons::DefineButtons()
|
||||
|
||||
clearButtons();
|
||||
|
||||
for (int i = 0; i < input_->getNumControllers(); ++i) {
|
||||
// controller_names_.emplace_back(input_->getControllerName(i));
|
||||
auto gamepads = input_->getGamepads();
|
||||
for (auto gamepad : gamepads) {
|
||||
controller_names_.emplace_back(input_->getControllerName(gamepad));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +29,9 @@ DefineButtons::DefineButtons()
|
||||
void DefineButtons::render() {
|
||||
static auto text = Resource::get()->getText("8bithud");
|
||||
if (enabled_) {
|
||||
// text->writeCentered(x_, y_ - 10, Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(Options::controllers.at(index_controller_).player_id));
|
||||
// text->writeCentered(x_, y_, controller_names_.at(index_controller_));
|
||||
// text->writeCentered(x_, y_ + 10, buttons_.at(index_button_).label);
|
||||
text->writeCentered(x_, y_ - 10, Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(static_cast<int>(gamepad_options_->player_id)));
|
||||
text->writeCentered(x_, y_, gamepad_options_->instance->name);
|
||||
text->writeCentered(x_, y_ + 10, buttons_.at(index_button_).label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,15 +77,15 @@ void DefineButtons::checkEvents(const SDL_Event &event) {
|
||||
}
|
||||
|
||||
// Habilita el objeto
|
||||
auto DefineButtons::enable(int index) -> bool {
|
||||
if (index < input_->getNumControllers()) {
|
||||
auto DefineButtons::enable(std::shared_ptr<Options::Gamepad> gamepad_options) -> bool {
|
||||
if (gamepad_options != nullptr) {
|
||||
gamepad_options_ = gamepad_options;
|
||||
enabled_ = true;
|
||||
finished_ = false;
|
||||
index_button_ = 0;
|
||||
clearButtons();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user