changeset 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 ea7d5ced2415
files nuklear_ui/blastem_nuklear.c
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/nuklear_ui/blastem_nuklear.c	Tue May 01 19:27:17 2018 -0700
+++ b/nuklear_ui/blastem_nuklear.c	Tue May 01 20:19:31 2018 -0700
@@ -77,10 +77,10 @@
 	uint32_t width = render_width();
 	uint32_t height = render_height();
 	if (nk_begin(context, "Load ROM", nk_rect(0, 0, width, height), 0)) {
-		nk_layout_row_static(context, height - 100, width - 60, 1);
+		nk_layout_row_static(context, height - context->style.font->height * 3, width - 60, 1);
 		int32_t old_selected = selected_entry;
 		if (nk_group_begin(context, "Select ROM", NK_WINDOW_BORDER | NK_WINDOW_TITLE)) {
-			nk_layout_row_static(context, 28, width-100, 1);
+			nk_layout_row_static(context, context->style.font->height - 2, width-100, 1);
 			for (int32_t i = 0; i < num_entries; i++)
 			{
 				if (entries[i].name[0] == '.' && entries[i].name[1] != '.') {
@@ -99,7 +99,7 @@
 			}
 			nk_group_end(context);
 		}
-		nk_layout_row_static(context, 52, width > 600 ? 300 : width / 2, 2);
+		nk_layout_row_static(context, context->style.font->height * 1.75, width > 600 ? 300 : width / 2, 2);
 		if (nk_button_label(context, "Back")) {
 			pop_view();
 		}
@@ -174,21 +174,21 @@
 	uint32_t width = render_width();
 	uint32_t height = render_height();
 	if (nk_begin(context, "About", nk_rect(0, 0, width, height), 0)) {
-		nk_layout_row_static(context, 30, width-40, 1);
+		nk_layout_row_static(context, context->style.font->height, width-40, 1);
 		for (uint32_t i = 0; i < NUM_LINES; i++)
 		{
 			nk_label(context, lines[i], NK_TEXT_LEFT);
 		}
-		nk_layout_row_static(context, height - 80 - 34*NUM_LINES, width-40, 1);
+		nk_layout_row_static(context, height - (context->style.font->height * 2 + 20) - (context->style.font->height +4)*NUM_LINES, width-40, 1);
 		if (nk_group_begin(context, "Special Thanks", NK_WINDOW_TITLE)) {
-			nk_layout_row_static(context, 30, width - 80, 1);
+			nk_layout_row_static(context, context->style.font->height, width - 80, 1);
 			for (uint32_t i = 0; i < NUM_THANKS; i++)
 			{
 				nk_label(context, thanks[i], NK_TEXT_LEFT);
 			}
 			nk_group_end(context);
 		}
-		nk_layout_row_static(context, 52, width/3, 1);
+		nk_layout_row_static(context, context->style.font->height * 1.75, width/3, 1);
 		if (nk_button_label(context, "Back")) {
 			pop_view();
 		}
@@ -209,9 +209,9 @@
 	uint32_t width = render_width();
 	uint32_t height = render_height();
 	if (nk_begin(context, "Slot Picker", nk_rect(0, 0, width, height), 0)) {
-		nk_layout_row_static(context, height - 100, width - 60, 1);
+		nk_layout_row_static(context, height - context->style.font->height * 3, width - 60, 1);
 		if (nk_group_begin(context, "Select Save Slot", NK_WINDOW_BORDER | NK_WINDOW_TITLE)) {
-			nk_layout_row_static(context, 28, width-100, 1);
+			nk_layout_row_static(context, context->style.font->height - 2, width-100, 1);
 			if (!slots) {
 				slots = get_slot_info(current_system, &num_slots);
 			}
@@ -225,7 +225,7 @@
 			}
 			nk_group_end(context);
 		}
-		nk_layout_row_static(context, 52, width > 600 ? 300 : width / 2, 2);
+		nk_layout_row_static(context, context->style.font->height * 1.75, width > 600 ? 300 : width / 2, 2);
 		if (nk_button_label(context, "Back")) {
 			pop_view();
 		}