Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 1500:39a199dca772 nuklear_ui
Added dropdowns for default region and savestate format
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 11 Dec 2017 09:50:47 -0800 |
parents | 756f8616d1bf |
children | 31a2997b745e |
comparison
equal
deleted
inserted
replaced
1499:756f8616d1bf | 1500:39a199dca772 |
---|---|
436 } | 436 } |
437 } | 437 } |
438 return selected; | 438 return selected; |
439 } | 439 } |
440 | 440 |
441 int32_t settings_dropdown(struct nk_context *context, char *label, const char **options, uint32_t num_options, int32_t current, char *path) | 441 int32_t settings_dropdown_ex(struct nk_context *context, char *label, const char **options, const char **opt_display, uint32_t num_options, int32_t current, char *path) |
442 { | 442 { |
443 nk_label(context, label, NK_TEXT_LEFT); | 443 nk_label(context, label, NK_TEXT_LEFT); |
444 int32_t next = nk_combo(context, options, num_options, current, 30, nk_vec2(300, 300)); | 444 int32_t next = nk_combo(context, opt_display, num_options, current, 30, nk_vec2(300, 300)); |
445 if (next != current) { | 445 if (next != current) { |
446 config = tern_insert_path(config, path, (tern_val){.ptrval = strdup(options[next])}, TVAL_PTR); | 446 config = tern_insert_path(config, path, (tern_val){.ptrval = strdup(options[next])}, TVAL_PTR); |
447 } | 447 } |
448 return next; | 448 return next; |
449 } | |
450 | |
451 int32_t settings_dropdown(struct nk_context *context, char *label, const char **options, uint32_t num_options, int32_t current, char *path) | |
452 { | |
453 return settings_dropdown_ex(context, label, options, options, num_options, current, path); | |
449 } | 454 } |
450 | 455 |
451 void view_audio_settings(struct nk_context *context) | 456 void view_audio_settings(struct nk_context *context) |
452 { | 457 { |
453 const char *rates[] = { | 458 const char *rates[] = { |
485 nk_end(context); | 490 nk_end(context); |
486 } | 491 } |
487 } | 492 } |
488 void view_system_settings(struct nk_context *context) | 493 void view_system_settings(struct nk_context *context) |
489 { | 494 { |
495 const char *regions[] = { | |
496 "J - Japan", | |
497 "U - Americas", | |
498 "E - Europe" | |
499 }; | |
500 const char *region_codes[] = {"J", "U", "E"}; | |
501 const uint32_t num_regions = sizeof(regions)/sizeof(*regions); | |
502 static int32_t selected_region = -1; | |
503 if (selected_region < 0) { | |
504 selected_region = find_match(region_codes, num_regions, "system\0default_region\0", "U"); | |
505 } | |
506 const char *formats[] = { | |
507 "native", | |
508 "gst" | |
509 }; | |
510 const uint32_t num_formats = sizeof(formats)/sizeof(*formats); | |
511 int32_t selected_format = -1; | |
512 if (selected_format < 0) { | |
513 selected_format = find_match(formats, num_formats, "ui\0state_format\0", "native"); | |
514 } | |
490 uint32_t width = render_width(); | 515 uint32_t width = render_width(); |
491 uint32_t height = render_height(); | 516 uint32_t height = render_height(); |
492 if (nk_begin(context, "System Settings", nk_rect(0, 0, width, height), 0)) { | 517 if (nk_begin(context, "System Settings", nk_rect(0, 0, width, height), 0)) { |
493 nk_layout_row_static(context, 30, width > 300 ? 300 : width, 2); | 518 nk_layout_row_static(context, 30, width > 300 ? 300 : width, 2); |
494 settings_int_property(context, "68000 Clock Divider", "", "clocks\0m68k_divider\0", 7, 1, 53); | 519 settings_int_property(context, "68000 Clock Divider", "", "clocks\0m68k_divider\0", 7, 1, 53); |
495 settings_toggle(context, "Remember ROM Path", "ui\0remember_path\0", 1); | 520 settings_toggle(context, "Remember ROM Path", "ui\0remember_path\0", 1); |
521 selected_region = settings_dropdown_ex(context, "Default Region", region_codes, regions, num_regions, selected_region, "system\0default_region\0"); | |
522 selected_format = settings_dropdown(context, "Save State Format", formats, num_formats, selected_format, "ui\0state_format\0"); | |
496 if (nk_button_label(context, "Back")) { | 523 if (nk_button_label(context, "Back")) { |
497 pop_view(); | 524 pop_view(); |
498 } | 525 } |
499 nk_end(context); | 526 nk_end(context); |
500 } | 527 } |