comparison nuklear_ui/blastem_nuklear.c @ 2016:2d8748e0ccb2

Show current path in file browser
author Michael Pavone <pavone@retrodev.com>
date Sat, 07 Nov 2020 14:19:02 -0800
parents 8a64d86cc362
children 8e7b06ade815
comparison
equal deleted inserted replaced
2015:8a64d86cc362 2016:2d8748e0ccb2
96 uint32_t width = render_width(); 96 uint32_t width = render_width();
97 uint32_t height = render_height(); 97 uint32_t height = render_height();
98 if (nk_begin(context, "Load ROM", nk_rect(0, 0, width, height), 0)) { 98 if (nk_begin(context, "Load ROM", nk_rect(0, 0, width, height), 0)) {
99 nk_layout_row_static(context, height - context->style.font->height * 3, width - 60, 1); 99 nk_layout_row_static(context, height - context->style.font->height * 3, width - 60, 1);
100 int32_t old_selected = selected_entry; 100 int32_t old_selected = selected_entry;
101 if (nk_group_begin(context, "Select ROM", NK_WINDOW_BORDER | NK_WINDOW_TITLE)) { 101 char *title = alloc_concat("Select ROM: ", current_path);
102 if (nk_group_begin(context, title, NK_WINDOW_BORDER | NK_WINDOW_TITLE)) {
102 nk_layout_row_static(context, context->style.font->height - 2, width-100, 1); 103 nk_layout_row_static(context, context->style.font->height - 2, width-100, 1);
103 for (int32_t i = 0; i < num_entries; i++) 104 for (int32_t i = 0; i < num_entries; i++)
104 { 105 {
105 if (entries[i].name[0] == '.' && entries[i].name[1] != '.') { 106 if (entries[i].name[0] == '.' && entries[i].name[1] != '.') {
106 continue; 107 continue;
116 selected_entry = -1; 117 selected_entry = -1;
117 } 118 }
118 } 119 }
119 nk_group_end(context); 120 nk_group_end(context);
120 } 121 }
122 free(title);
121 nk_layout_row_static(context, context->style.font->height * 1.75, width > 600 ? 300 : width / 2, 2); 123 nk_layout_row_static(context, context->style.font->height * 1.75, width > 600 ? 300 : width / 2, 2);
122 if (nk_button_label(context, "Back")) { 124 if (nk_button_label(context, "Back")) {
123 pop_view(); 125 pop_view();
124 } 126 }
125 if (nk_button_label(context, "Open") || (old_selected >= 0 && selected_entry < 0)) { 127 if (nk_button_label(context, "Open") || (old_selected >= 0 && selected_entry < 0)) {