comparison nuklear_ui/blastem_nuklear.c @ 1841:5d10b8494b02

WIP keyboard nav for Nuklear menus
author Michael Pavone <pavone@retrodev.com>
date Fri, 19 Apr 2019 21:09:46 -0700
parents 478ab1f4ff94
children a4cae960fd08
comparison
equal deleted inserted replaced
1840:3d0b20e9a187 1841:5d10b8494b02
48 view_storage = view_storage ? 2*view_storage : 2; 48 view_storage = view_storage ? 2*view_storage : 2;
49 previous_views = realloc(previous_views, view_storage*sizeof(view_fun)); 49 previous_views = realloc(previous_views, view_storage*sizeof(view_fun));
50 } 50 }
51 previous_views[num_prev++] = current_view; 51 previous_views[num_prev++] = current_view;
52 current_view = new_view; 52 current_view = new_view;
53 context->input.selected_widget = 0;
53 } 54 }
54 55
55 static void pop_view() 56 static void pop_view()
56 { 57 {
57 if (num_prev) { 58 if (num_prev) {
58 current_view = previous_views[--num_prev]; 59 current_view = previous_views[--num_prev];
60 context->input.selected_widget = 0;
59 } 61 }
60 } 62 }
61 63
62 static void clear_view_stack() 64 static void clear_view_stack()
63 { 65 {
2069 if (current_view == view_play) { 2071 if (current_view == view_play) {
2070 set_content_binding_state(0); 2072 set_content_binding_state(0);
2071 context->style.window.background = nk_rgba(0, 0, 0, 128); 2073 context->style.window.background = nk_rgba(0, 0, 0, 128);
2072 context->style.window.fixed_background = nk_style_item_color(nk_rgba(0, 0, 0, 128)); 2074 context->style.window.fixed_background = nk_style_item_color(nk_rgba(0, 0, 0, 128));
2073 current_view = view_pause; 2075 current_view = view_pause;
2076 context->input.selected_widget = 0;
2074 current_system->request_exit(current_system); 2077 current_system->request_exit(current_system);
2075 } else if (current_system && !set_binding) { 2078 } else if (current_system && !set_binding) {
2076 clear_view_stack(); 2079 clear_view_stack();
2077 show_play_view(); 2080 show_play_view();
2078 } 2081 }
2080 2083
2081 void show_play_view(void) 2084 void show_play_view(void)
2082 { 2085 {
2083 set_content_binding_state(1); 2086 set_content_binding_state(1);
2084 current_view = view_play; 2087 current_view = view_play;
2088 context->input.selected_widget = 0;
2085 } 2089 }
2086 2090
2087 static uint8_t active; 2091 static uint8_t active;
2088 uint8_t is_nuklear_active(void) 2092 uint8_t is_nuklear_active(void)
2089 { 2093 {