From 7a0cc4165f8d40504da1c6a9fcd02b5f1deb8567 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 26 Mar 2019 23:45:11 -0700 Subject: Skip buttons or axes in the mapping UI that have no label for the selected controller type --- nuklear_ui/blastem_nuklear.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'nuklear_ui/blastem_nuklear.c') 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; } } } -- cgit v1.2.3