comparison nuklear_ui/blastem_nuklear.c @ 1487:6a35815cc409 nuklear_ui

Enable lock-on in Nuklear UI
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Nov 2017 20:17:22 -0800
parents a6881d0d76d0
children 919c0c33885e
comparison
equal deleted inserted replaced
1486:a6881d0d76d0 1487:6a35815cc409
21 void view_play(struct nk_context *context) 21 void view_play(struct nk_context *context)
22 { 22 {
23 23
24 } 24 }
25 25
26 void view_load(struct nk_context *context) 26 void view_file_browser(struct nk_context *context, uint8_t normal_open)
27 { 27 {
28 static char *current_path; 28 static char *current_path;
29 static dir_entry *entries; 29 static dir_entry *entries;
30 static size_t num_entries; 30 static size_t num_entries;
31 static uint32_t selected_entry; 31 static uint32_t selected_entry;
77 free(current_path); 77 free(current_path);
78 current_path = full_path; 78 current_path = full_path;
79 free_dir_list(entries, num_entries); 79 free_dir_list(entries, num_entries);
80 entries = NULL; 80 entries = NULL;
81 } else { 81 } else {
82 if (current_system) { 82 if(normal_open) {
83 current_system->next_rom = full_path; 83 if (current_system) {
84 current_system->request_exit(current_system); 84 current_system->next_rom = full_path;
85 current_system->request_exit(current_system);
86 } else {
87 init_system_with_media(full_path, SYSTEM_UNKNOWN);
88 free(full_path);
89 }
85 } else { 90 } else {
86 init_system_with_media(full_path, SYSTEM_UNKNOWN); 91 lockon_media(full_path);
87 free(full_path); 92 free(full_path);
88 } 93 }
89 current_view = view_play; 94 current_view = view_play;
90 } 95 }
91 } 96 }
92 nk_end(context); 97 nk_end(context);
93 } 98 }
99 }
100
101 void view_load(struct nk_context *context)
102 {
103 view_file_browser(context, 1);
104 }
105
106 void view_lock_on(struct nk_context *context)
107 {
108 view_file_browser(context, 0);
94 } 109 }
95 110
96 void view_about(struct nk_context *context) 111 void view_about(struct nk_context *context)
97 { 112 {
98 } 113 }
189 void view_pause(struct nk_context *context) 204 void view_pause(struct nk_context *context)
190 { 205 {
191 static menu_item items[] = { 206 static menu_item items[] = {
192 {"Resume", view_play}, 207 {"Resume", view_play},
193 {"Load ROM", view_load}, 208 {"Load ROM", view_load},
209 {"Lock On", view_lock_on},
194 {"Save State", view_save_state}, 210 {"Save State", view_save_state},
195 {"Load State", view_load_state}, 211 {"Load State", view_load_state},
196 {"Exit", NULL} 212 {"Exit", NULL}
197 }; 213 };
198 214