comparison nuklear_ui/blastem_nuklear.c @ 2015:8a64d86cc362

Use different variants for Genesis controllers to better represent what types are out there
author Michael Pavone <pavone@retrodev.com>
date Wed, 04 Nov 2020 22:55:26 -0800
parents 9ca255be938d
children 2d8748e0ccb2
comparison
equal deleted inserted replaced
2014:9ca255be938d 2015:8a64d86cc362
1330 nk_layout_row_static(context, context->style.font->height*1.25, render_width() - context->style.font->height * 2, 1); 1330 nk_layout_row_static(context, context->style.font->height*1.25, render_width() - context->style.font->height * 2, 1);
1331 nk_label(context, "", NK_TEXT_CENTERED); 1331 nk_label(context, "", NK_TEXT_CENTERED);
1332 nk_label(context, "Select the layout that", NK_TEXT_CENTERED); 1332 nk_label(context, "Select the layout that", NK_TEXT_CENTERED);
1333 nk_label(context, "best matches your controller", NK_TEXT_CENTERED); 1333 nk_label(context, "best matches your controller", NK_TEXT_CENTERED);
1334 nk_label(context, "", NK_TEXT_CENTERED); 1334 nk_label(context, "", NK_TEXT_CENTERED);
1335 if (nk_button_label(context, "4 face buttons")) { 1335 if (selected_controller_info.subtype == SUBTYPE_GENESIS) {
1336 selected_controller_info.variant = VARIANT_NORMAL; 1336 if (nk_button_label(context, "3 button")) {
1337 selected = 1; 1337 selected_controller_info.variant = VARIANT_3BUTTON;
1338 } 1338 selected = 1;
1339 char buffer[512]; 1339 }
1340 snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s", 1340 if (nk_button_label(context, "Standard 6 button")) {
1341 get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER), 1341 selected_controller_info.variant = VARIANT_6B_BUMPERS;
1342 get_axis_label(&selected_controller_info, SDL_CONTROLLER_AXIS_TRIGGERRIGHT) 1342 selected = 1;
1343 ); 1343 }
1344 if (nk_button_label(context, buffer)) { 1344 if (nk_button_label(context, "6 button with 2 shoulder buttons")) {
1345 selected_controller_info.variant = VARIANT_6B_RIGHT; 1345 selected_controller_info.variant = VARIANT_8BUTTON;
1346 selected = 1; 1346 selected = 1;
1347 } 1347 }
1348 snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s", 1348 } else {
1349 get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_LEFTSHOULDER), 1349 if (nk_button_label(context, "4 face buttons")) {
1350 get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) 1350 selected_controller_info.variant = VARIANT_NORMAL;
1351 ); 1351 selected = 1;
1352 if (nk_button_label(context, buffer)) { 1352 }
1353 selected_controller_info.variant = VARIANT_6B_BUMPERS; 1353 char buffer[512];
1354 selected = 1; 1354 snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s",
1355 get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER),
1356 get_axis_label(&selected_controller_info, SDL_CONTROLLER_AXIS_TRIGGERRIGHT)
1357 );
1358 if (nk_button_label(context, buffer)) {
1359 selected_controller_info.variant = VARIANT_6B_RIGHT;
1360 selected = 1;
1361 }
1362 snprintf(buffer, sizeof(buffer), "6 face buttons including %s and %s",
1363 get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_LEFTSHOULDER),
1364 get_button_label(&selected_controller_info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
1365 );
1366 if (nk_button_label(context, buffer)) {
1367 selected_controller_info.variant = VARIANT_6B_BUMPERS;
1368 selected = 1;
1369 }
1355 } 1370 }
1356 nk_end(context); 1371 nk_end(context);
1357 } 1372 }
1358 if (selected) { 1373 if (selected) {
1359 save_controller_info(selected_controller, &selected_controller_info); 1374 save_controller_info(selected_controller, &selected_controller_info);
1380 { 1395 {
1381 if (nk_button_label(context, types[i])) { 1396 if (nk_button_label(context, types[i])) {
1382 selected_controller_info.type = type_id; 1397 selected_controller_info.type = type_id;
1383 selected_controller_info.subtype = first_subtype_id + i; 1398 selected_controller_info.subtype = first_subtype_id + i;
1384 pop_view(); 1399 pop_view();
1385 push_view(view_controller_variant); 1400 if (selected_controller_info.subtype == SUBTYPE_SATURN) {
1401 selected_controller_info.variant = VARIANT_6B_BUMPERS;
1402 save_controller_info(selected_controller, &selected_controller_info);
1403 if (initial_controller_config) {
1404 SDL_GameController *controller = render_get_controller(selected_controller);
1405 if (controller) {
1406 push_view(view_controller_bindings);
1407 controller_binding_changed = 0;
1408 SDL_GameControllerClose(controller);
1409 } else {
1410 show_mapping_view();
1411 }
1412 }
1413 } else {
1414 push_view(view_controller_variant);
1415 }
1386 } 1416 }
1387 } 1417 }
1388 nk_group_end(context); 1418 nk_group_end(context);
1389 } 1419 }
1390 } 1420 }