diff options
author | Michael Pavone <pavone@retrodev.com> | 2019-03-26 23:45:11 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2019-03-26 23:45:11 -0700 |
commit | 7a0cc4165f8d40504da1c6a9fcd02b5f1deb8567 (patch) | |
tree | 26ab01c65ad9b17862f848630838a8f63b40b194 /nuklear_ui | |
parent | dfa3aa9317e1ebd418b958ead4b1502c0943cf75 (diff) |
Skip buttons or axes in the mapping UI that have no label for the selected controller type
Diffstat (limited to 'nuklear_ui')
-rw-r--r-- | nuklear_ui/blastem_nuklear.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nuklear_ui/blastem_nuklear.c b/nuklear_ui/blastem_nuklear.c index dbd4ffb..2cadf5f 100644 --- a/nuklear_ui/blastem_nuklear.c +++ b/nuklear_ui/blastem_nuklear.c @@ -1228,12 +1228,17 @@ static void view_controller_mappings(struct nk_context *context) } } - if (added_mapping) { + while (added_mapping) { quiet = QUIET_FRAMES; if (current_button < SDL_CONTROLLER_BUTTON_MAX) { current_button++; if (current_button == SDL_CONTROLLER_BUTTON_MAX) { current_axis = 0; + if (get_axis_label(&selected_controller_info, current_axis)) { + added_mapping = 0; + } + } else if (get_button_label(&selected_controller_info, current_button)) { + added_mapping = 0; } } else { current_axis++; @@ -1246,6 +1251,9 @@ static void view_controller_mappings(struct nk_context *context) pop_view(); push_view(view_controller_bindings); controller_binding_changed = 0; + added_mapping = 0; + } else if (get_axis_label(&selected_controller_info, current_axis)) { + added_mapping = 0; } } } |