mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 09:55:45 +00:00
input_common: Make button threshold customizable
This commit is contained in:
parent
24f798804c
commit
9e0f89e081
2 changed files with 13 additions and 3 deletions
|
@ -313,6 +313,16 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
|||
buttons_param[button_id].Set("toggle", toggle_value);
|
||||
button_map[button_id]->setText(ButtonToText(buttons_param[button_id]));
|
||||
});
|
||||
if (buttons_param[button_id].Has("threshold")) {
|
||||
context_menu.addAction(tr("Set threshold"), [&] {
|
||||
const int button_threshold = static_cast<int>(
|
||||
buttons_param[button_id].Get("threshold", 0.5f) * 100.0f);
|
||||
const int new_threshold = QInputDialog::getInt(
|
||||
this, tr("Set threshold"), tr("Choose a value between 0% and 100%"),
|
||||
button_threshold, 0, 100);
|
||||
buttons_param[button_id].Set("threshold", new_threshold / 100.0f);
|
||||
});
|
||||
}
|
||||
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
||||
ui->controllerFrame->SetPlayerInput(player_index, buttons_param, analogs_param);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue