changeset 1806:396369ab481a

Skip buttons or axes in the mapping UI that have no label for the selected controller type
author Michael Pavone <pavone@retrodev.com>
date Tue, 26 Mar 2019 23:45:11 -0700
parents 930c11348874
children a218c253fcb3
files nuklear_ui/blastem_nuklear.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nuklear_ui/blastem_nuklear.c	Tue Mar 26 23:27:46 2019 -0700
+++ b/nuklear_ui/blastem_nuklear.c	Tue Mar 26 23:45:11 2019 -0700
@@ -1228,12 +1228,17 @@
 			}
 		}
 			
-		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 @@
 					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;
 				}
 			}
 		}