comparison nuklear_ui/blastem_nuklear.c @ 2022:380bc5d4a2cf

Fix format of axis mapping strings for axes that map to a d-pad
author Michael Pavone <pavone@retrodev.com>
date Tue, 24 Nov 2020 23:15:25 -0800
parents e42c45ff06d5
children 237068a25523
comparison
equal deleted inserted replaced
2021:270a4c875e0a 2022:380bc5d4a2cf
1259 axis_value/abs(axis_value) != last_axis_value/abs(axis_value) && current_button >= SDL_CONTROLLER_BUTTON_DPAD_UP 1259 axis_value/abs(axis_value) != last_axis_value/abs(axis_value) && current_button >= SDL_CONTROLLER_BUTTON_DPAD_UP
1260 ) 1260 )
1261 )) { 1261 )) {
1262 if (current_button <= SDL_CONTROLLER_BUTTON_B || axis_moved != button_a_axis) { 1262 if (current_button <= SDL_CONTROLLER_BUTTON_B || axis_moved != button_a_axis) {
1263 start_mapping(); 1263 start_mapping();
1264 if (current_button >= SDL_CONTROLLER_BUTTON_DPAD_UP) {
1265 mapping_string[mapping_pos++] = axis_value >= 0 ? '+' : '-';
1266 }
1264 mapping_string[mapping_pos++] = 'a'; 1267 mapping_string[mapping_pos++] = 'a';
1265 if (axis_moved > 9) { 1268 if (axis_moved > 9) {
1266 mapping_string[mapping_pos++] = '0' + axis_moved / 10; 1269 mapping_string[mapping_pos++] = '0' + axis_moved / 10;
1267 } 1270 }
1268 mapping_string[mapping_pos++] = '0' + axis_moved % 10; 1271 mapping_string[mapping_pos++] = '0' + axis_moved % 10;
1269 if (current_button >= SDL_CONTROLLER_BUTTON_DPAD_UP) {
1270 mapping_string[mapping_pos++] = axis_value >= 0 ? '+' : '-';
1271 }
1272 last_axis = axis_moved; 1272 last_axis = axis_moved;
1273 last_axis_value = axis_value; 1273 last_axis_value = axis_value;
1274 } 1274 }
1275 added_mapping = 1; 1275 added_mapping = 1;
1276 } 1276 }