Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 1579:f66290afae65
Add some basic scaling to rest of UI
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 01 May 2018 20:19:31 -0700 |
parents | aaa28c9bf67d |
children | 7121daaa48c2 |
comparison
equal
deleted
inserted
replaced
1578:aaa28c9bf67d | 1579:f66290afae65 |
---|---|
75 got_ext_list = 1; | 75 got_ext_list = 1; |
76 } | 76 } |
77 uint32_t width = render_width(); | 77 uint32_t width = render_width(); |
78 uint32_t height = render_height(); | 78 uint32_t height = render_height(); |
79 if (nk_begin(context, "Load ROM", nk_rect(0, 0, width, height), 0)) { | 79 if (nk_begin(context, "Load ROM", nk_rect(0, 0, width, height), 0)) { |
80 nk_layout_row_static(context, height - 100, width - 60, 1); | 80 nk_layout_row_static(context, height - context->style.font->height * 3, width - 60, 1); |
81 int32_t old_selected = selected_entry; | 81 int32_t old_selected = selected_entry; |
82 if (nk_group_begin(context, "Select ROM", NK_WINDOW_BORDER | NK_WINDOW_TITLE)) { | 82 if (nk_group_begin(context, "Select ROM", NK_WINDOW_BORDER | NK_WINDOW_TITLE)) { |
83 nk_layout_row_static(context, 28, width-100, 1); | 83 nk_layout_row_static(context, context->style.font->height - 2, width-100, 1); |
84 for (int32_t i = 0; i < num_entries; i++) | 84 for (int32_t i = 0; i < num_entries; i++) |
85 { | 85 { |
86 if (entries[i].name[0] == '.' && entries[i].name[1] != '.') { | 86 if (entries[i].name[0] == '.' && entries[i].name[1] != '.') { |
87 continue; | 87 continue; |
88 } | 88 } |
97 selected_entry = -1; | 97 selected_entry = -1; |
98 } | 98 } |
99 } | 99 } |
100 nk_group_end(context); | 100 nk_group_end(context); |
101 } | 101 } |
102 nk_layout_row_static(context, 52, width > 600 ? 300 : width / 2, 2); | 102 nk_layout_row_static(context, context->style.font->height * 1.75, width > 600 ? 300 : width / 2, 2); |
103 if (nk_button_label(context, "Back")) { | 103 if (nk_button_label(context, "Back")) { |
104 pop_view(); | 104 pop_view(); |
105 } | 105 } |
106 if (nk_button_label(context, "Open") || (old_selected >= 0 && selected_entry < 0)) { | 106 if (nk_button_label(context, "Open") || (old_selected >= 0 && selected_entry < 0)) { |
107 if (selected_entry < 0) { | 107 if (selected_entry < 0) { |
172 }; | 172 }; |
173 const uint32_t NUM_THANKS = sizeof(thanks)/sizeof(*thanks); | 173 const uint32_t NUM_THANKS = sizeof(thanks)/sizeof(*thanks); |
174 uint32_t width = render_width(); | 174 uint32_t width = render_width(); |
175 uint32_t height = render_height(); | 175 uint32_t height = render_height(); |
176 if (nk_begin(context, "About", nk_rect(0, 0, width, height), 0)) { | 176 if (nk_begin(context, "About", nk_rect(0, 0, width, height), 0)) { |
177 nk_layout_row_static(context, 30, width-40, 1); | 177 nk_layout_row_static(context, context->style.font->height, width-40, 1); |
178 for (uint32_t i = 0; i < NUM_LINES; i++) | 178 for (uint32_t i = 0; i < NUM_LINES; i++) |
179 { | 179 { |
180 nk_label(context, lines[i], NK_TEXT_LEFT); | 180 nk_label(context, lines[i], NK_TEXT_LEFT); |
181 } | 181 } |
182 nk_layout_row_static(context, height - 80 - 34*NUM_LINES, width-40, 1); | 182 nk_layout_row_static(context, height - (context->style.font->height * 2 + 20) - (context->style.font->height +4)*NUM_LINES, width-40, 1); |
183 if (nk_group_begin(context, "Special Thanks", NK_WINDOW_TITLE)) { | 183 if (nk_group_begin(context, "Special Thanks", NK_WINDOW_TITLE)) { |
184 nk_layout_row_static(context, 30, width - 80, 1); | 184 nk_layout_row_static(context, context->style.font->height, width - 80, 1); |
185 for (uint32_t i = 0; i < NUM_THANKS; i++) | 185 for (uint32_t i = 0; i < NUM_THANKS; i++) |
186 { | 186 { |
187 nk_label(context, thanks[i], NK_TEXT_LEFT); | 187 nk_label(context, thanks[i], NK_TEXT_LEFT); |
188 } | 188 } |
189 nk_group_end(context); | 189 nk_group_end(context); |
190 } | 190 } |
191 nk_layout_row_static(context, 52, width/3, 1); | 191 nk_layout_row_static(context, context->style.font->height * 1.75, width/3, 1); |
192 if (nk_button_label(context, "Back")) { | 192 if (nk_button_label(context, "Back")) { |
193 pop_view(); | 193 pop_view(); |
194 } | 194 } |
195 nk_end(context); | 195 nk_end(context); |
196 } | 196 } |
207 void view_choose_state(struct nk_context *context, uint8_t is_load) | 207 void view_choose_state(struct nk_context *context, uint8_t is_load) |
208 { | 208 { |
209 uint32_t width = render_width(); | 209 uint32_t width = render_width(); |
210 uint32_t height = render_height(); | 210 uint32_t height = render_height(); |
211 if (nk_begin(context, "Slot Picker", nk_rect(0, 0, width, height), 0)) { | 211 if (nk_begin(context, "Slot Picker", nk_rect(0, 0, width, height), 0)) { |
212 nk_layout_row_static(context, height - 100, width - 60, 1); | 212 nk_layout_row_static(context, height - context->style.font->height * 3, width - 60, 1); |
213 if (nk_group_begin(context, "Select Save Slot", NK_WINDOW_BORDER | NK_WINDOW_TITLE)) { | 213 if (nk_group_begin(context, "Select Save Slot", NK_WINDOW_BORDER | NK_WINDOW_TITLE)) { |
214 nk_layout_row_static(context, 28, width-100, 1); | 214 nk_layout_row_static(context, context->style.font->height - 2, width-100, 1); |
215 if (!slots) { | 215 if (!slots) { |
216 slots = get_slot_info(current_system, &num_slots); | 216 slots = get_slot_info(current_system, &num_slots); |
217 } | 217 } |
218 for (uint32_t i = 0; i < num_slots; i++) | 218 for (uint32_t i = 0; i < num_slots; i++) |
219 { | 219 { |
223 selected_slot = i; | 223 selected_slot = i; |
224 } | 224 } |
225 } | 225 } |
226 nk_group_end(context); | 226 nk_group_end(context); |
227 } | 227 } |
228 nk_layout_row_static(context, 52, width > 600 ? 300 : width / 2, 2); | 228 nk_layout_row_static(context, context->style.font->height * 1.75, width > 600 ? 300 : width / 2, 2); |
229 if (nk_button_label(context, "Back")) { | 229 if (nk_button_label(context, "Back")) { |
230 pop_view(); | 230 pop_view(); |
231 } | 231 } |
232 if (is_load) { | 232 if (is_load) { |
233 if (nk_button_label(context, "Load")) { | 233 if (nk_button_label(context, "Load")) { |