canvi de pc
This commit is contained in:
@@ -12,8 +12,7 @@
|
||||
|
||||
// Constructor
|
||||
DefineButtons::DefineButtons()
|
||||
: input_(Input::get()),
|
||||
text_(Resource::get()->getText("8bithud")) {
|
||||
: input_(Input::get()) {
|
||||
// Inicializa variables
|
||||
x_ = param.game.width / 2;
|
||||
y_ = param.title.press_start_position;
|
||||
@@ -27,10 +26,11 @@ DefineButtons::DefineButtons()
|
||||
|
||||
// Dibuja el objeto en pantalla
|
||||
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(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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +49,14 @@ void DefineButtons::doControllerButtonDown(const SDL_GamepadButtonEvent &event)
|
||||
}
|
||||
|
||||
// Asigna los botones definidos al input_
|
||||
void DefineButtons::bindButtons() {
|
||||
void DefineButtons::bindButtons(std::shared_ptr<Input::Gamepad> gamepad) {
|
||||
for (const auto &button : buttons_) {
|
||||
input_->bindGameControllerButton(index_controller_, button.action, button.button);
|
||||
input_->bindGameControllerButton(gamepad, button.action, button.button);
|
||||
}
|
||||
|
||||
// Remapea los inputs a inputs
|
||||
input_->bindGameControllerButton(index_controller_, Input::Action::SM_SELECT, Input::Action::FIRE_LEFT);
|
||||
input_->bindGameControllerButton(index_controller_, Input::Action::SM_BACK, Input::Action::FIRE_CENTER);
|
||||
input_->bindGameControllerButton(gamepad, Input::Action::SM_SELECT, Input::Action::FIRE_LEFT);
|
||||
input_->bindGameControllerButton(gamepad, Input::Action::SM_BACK, Input::Action::FIRE_CENTER);
|
||||
}
|
||||
|
||||
// Comprueba los eventos
|
||||
@@ -80,7 +80,6 @@ auto DefineButtons::enable(int index) -> bool {
|
||||
if (index < input_->getNumControllers()) {
|
||||
enabled_ = true;
|
||||
finished_ = false;
|
||||
index_controller_ = index;
|
||||
index_button_ = 0;
|
||||
clearButtons();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user