Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 1545:3faf917bab56
Add back button to Key binding view and add a window and back button to empty controller view so you can always get back to the main menu
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 26 Mar 2018 09:49:03 -0700 |
parents | 4f6e8acd7b6a |
children | 577253765192 |
comparison
equal
deleted
inserted
replaced
1544:650178d81d33 | 1545:3faf917bab56 |
---|---|
423 binding_group(context, "Controller 1", controller1_binds, NULL, NUM_C1_BINDS, binding_lookup); | 423 binding_group(context, "Controller 1", controller1_binds, NULL, NUM_C1_BINDS, binding_lookup); |
424 binding_group(context, "Controller 2", controller2_binds, NULL, NUM_C2_BINDS, binding_lookup); | 424 binding_group(context, "Controller 2", controller2_binds, NULL, NUM_C2_BINDS, binding_lookup); |
425 binding_group(context, "General", general_binds, general_names, NUM_GEN_BINDS, binding_lookup); | 425 binding_group(context, "General", general_binds, general_names, NUM_GEN_BINDS, binding_lookup); |
426 binding_group(context, "Speed Control", speed_binds, speed_names, NUM_SPEED_BINDS, binding_lookup); | 426 binding_group(context, "Speed Control", speed_binds, speed_names, NUM_SPEED_BINDS, binding_lookup); |
427 binding_group(context, "Debug", debug_binds, debug_names, NUM_DBG_BINDS, binding_lookup); | 427 binding_group(context, "Debug", debug_binds, debug_names, NUM_DBG_BINDS, binding_lookup); |
428 | 428 nk_layout_row_static(context, 34, (render_width() - 80) / 2, 1); |
429 if (nk_button_label(context, "Back")) { | |
430 pop_view(); | |
431 } | |
429 nk_end(context); | 432 nk_end(context); |
430 } | 433 } |
431 if (set_binding && nk_begin(context, "Set Binding", nk_rect(width/4, height/4, width/2/*width*3/4*/, height/2), NK_WINDOW_TITLE | NK_WINDOW_BORDER)) { | 434 if (set_binding && nk_begin(context, "Set Binding", nk_rect(width/4, height/4, width/2/*width*3/4*/, height/2), NK_WINDOW_TITLE | NK_WINDOW_BORDER)) { |
432 nk_layout_row_static(context, 30, width/2-30, 1); | 435 nk_layout_row_static(context, 30, width/2-30, 1); |
433 nk_label(context, "Press new key for", NK_TEXT_CENTERED); | 436 nk_label(context, "Press new key for", NK_TEXT_CENTERED); |
469 nk_end(context); | 472 nk_end(context); |
470 } | 473 } |
471 } | 474 } |
472 void view_controllers(struct nk_context *context) | 475 void view_controllers(struct nk_context *context) |
473 { | 476 { |
474 | 477 if (nk_begin(context, "Controller Bindings", nk_rect(0, 0, render_width(), render_height()), 0)) { |
478 nk_layout_row_static(context, 34, (render_width() - 80) / 2, 1); | |
479 if (nk_button_label(context, "Back")) { | |
480 pop_view(); | |
481 } | |
482 nk_end(context); | |
483 } | |
475 } | 484 } |
476 | 485 |
477 void settings_toggle(struct nk_context *context, char *label, char *path, uint8_t def) | 486 void settings_toggle(struct nk_context *context, char *label, char *path, uint8_t def) |
478 { | 487 { |
479 uint8_t curval = !strcmp("on", tern_find_path_default(config, path, (tern_val){.ptrval = def ? "on": "off"}, TVAL_PTR).ptrval); | 488 uint8_t curval = !strcmp("on", tern_find_path_default(config, path, (tern_val){.ptrval = def ? "on": "off"}, TVAL_PTR).ptrval); |