diff options
author | german77 <juangerman-13@hotmail.com> | 2021-07-15 23:43:51 -0500 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2021-07-15 23:56:57 -0500 |
commit | 240019fecae5224d0532d0057650f27de017ebad (patch) | |
tree | 4aa109425266a762f812ab22bf762287de35c2b9 /src/yuzu/configuration/configure_input_player.cpp | |
parent | 3cd3230295a4752c57df1364bc14b17ffdcde762 (diff) |
input_common: Make button threshold customizable
Diffstat (limited to 'src/yuzu/configuration/configure_input_player.cpp')
-rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index d5d624b96..0d98e0986 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -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); }); |