Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 1672:12d0c7c4ad80
Disable most bindings when UI is active
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 03 Jan 2019 09:14:49 -0800 |
parents | a1e0ed70ad82 |
children | 357b4951d9b2 |
comparison
equal
deleted
inserted
replaced
1671:05c34078e1ac | 1672:12d0c7c4ad80 |
---|---|
137 } else { | 137 } else { |
138 lockon_media(full_path); | 138 lockon_media(full_path); |
139 free(full_path); | 139 free(full_path); |
140 } | 140 } |
141 clear_view_stack(); | 141 clear_view_stack(); |
142 current_view = view_play; | 142 show_play_view(); |
143 } | 143 } |
144 selected_entry = -1; | 144 selected_entry = -1; |
145 } | 145 } |
146 nk_end(context); | 146 nk_end(context); |
147 } | 147 } |
244 pop_view(); | 244 pop_view(); |
245 } | 245 } |
246 if (is_load) { | 246 if (is_load) { |
247 if (nk_button_label(context, "Load")) { | 247 if (nk_button_label(context, "Load")) { |
248 current_system->load_state(current_system, selected_slot); | 248 current_system->load_state(current_system, selected_slot); |
249 current_view = view_play; | 249 show_play_view(); |
250 } | 250 } |
251 } else { | 251 } else { |
252 if (nk_button_label(context, "Save")) { | 252 if (nk_button_label(context, "Save")) { |
253 current_system->save_state = selected_slot + 1; | 253 current_system->save_state = selected_slot + 1; |
254 current_view = view_play; | 254 show_play_view(); |
255 } | 255 } |
256 } | 256 } |
257 nk_end(context); | 257 nk_end(context); |
258 } | 258 } |
259 } | 259 } |
290 if (items[i].next_view) { | 290 if (items[i].next_view) { |
291 push_view(items[i].next_view); | 291 push_view(items[i].next_view); |
292 if (current_view == view_save_state || current_view == view_load_state) { | 292 if (current_view == view_save_state || current_view == view_load_state) { |
293 free_slot_info(slots); | 293 free_slot_info(slots); |
294 slots = NULL; | 294 slots = NULL; |
295 } else if (current_view == view_play) { | |
296 set_content_binding_state(1); | |
295 } | 297 } |
296 } else { | 298 } else { |
297 handler(i); | 299 handler(i); |
298 } | 300 } |
299 } | 301 } |
1915 texture_init(); | 1917 texture_init(); |
1916 } | 1918 } |
1917 | 1919 |
1918 void show_pause_menu(void) | 1920 void show_pause_menu(void) |
1919 { | 1921 { |
1922 set_content_binding_state(0); | |
1920 context->style.window.background = nk_rgba(0, 0, 0, 128); | 1923 context->style.window.background = nk_rgba(0, 0, 0, 128); |
1921 context->style.window.fixed_background = nk_style_item_color(nk_rgba(0, 0, 0, 128)); | 1924 context->style.window.fixed_background = nk_style_item_color(nk_rgba(0, 0, 0, 128)); |
1922 current_view = view_pause; | 1925 current_view = view_pause; |
1923 current_system->request_exit(current_system); | 1926 current_system->request_exit(current_system); |
1924 } | 1927 } |
1925 | 1928 |
1926 void show_play_view(void) | 1929 void show_play_view(void) |
1927 { | 1930 { |
1931 set_content_binding_state(1); | |
1928 current_view = view_play; | 1932 current_view = view_play; |
1929 } | 1933 } |
1930 | 1934 |
1931 static uint8_t active; | 1935 static uint8_t active; |
1932 uint8_t is_nuklear_active(void) | 1936 uint8_t is_nuklear_active(void) |
1994 controller_ps4 = load_ui_image("images/ps4.png"); | 1998 controller_ps4 = load_ui_image("images/ps4.png"); |
1995 controller_ps4_6b = load_ui_image("images/ps4_6b.png"); | 1999 controller_ps4_6b = load_ui_image("images/ps4_6b.png"); |
1996 | 2000 |
1997 texture_init(); | 2001 texture_init(); |
1998 | 2002 |
1999 current_view = file_loaded ? view_play : view_menu; | 2003 if (file_loaded) { |
2004 current_view = view_play; | |
2005 } else { | |
2006 current_view = view_menu; | |
2007 set_content_binding_state(0); | |
2008 } | |
2000 render_set_ui_render_fun(blastem_nuklear_render); | 2009 render_set_ui_render_fun(blastem_nuklear_render); |
2001 render_set_event_handler(handle_event); | 2010 render_set_event_handler(handle_event); |
2002 render_set_gl_context_handlers(context_destroyed, context_created); | 2011 render_set_gl_context_handlers(context_destroyed, context_created); |
2003 | 2012 |
2004 atexit(persist_config_exit); | 2013 atexit(persist_config_exit); |