Mercurial > repos > blastem
changeset 2694:a6a27d4aa8ab
Ensure debug UI is not scaled based on main window size
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 19 Jun 2025 20:24:14 -0700 |
parents | 46dba737b931 |
children | 84771c6e31c5 |
files | nuklear_ui/blastem_nuklear.c |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/nuklear_ui/blastem_nuklear.c Thu Jun 19 19:59:05 2025 -0700 +++ b/nuklear_ui/blastem_nuklear.c Thu Jun 19 20:24:14 2025 -0700 @@ -2737,8 +2737,9 @@ return nk_image_ptr(fbimg); } -static void font_init(struct nk_context *ctx) +static void font_init(uint8_t window, struct nk_context *ctx) { + uint32_t height = window < FRAMEBUFFER_USER_START ? render_height() : 480; struct nk_font_atlas *atlas; if (fb_context) { nk_rawfb_font_stash_begin(fb_context, &atlas); @@ -2752,7 +2753,7 @@ if (!font) { fatal_error("Failed to find default font path\n"); } - def_font = nk_font_atlas_add_from_memory(atlas, font, font_size, render_height() / 24, NULL); + def_font = nk_font_atlas_add_from_memory(atlas, font, font_size, height / 24, NULL); free(font); if (fb_context) { nk_rawfb_font_stash_end(fb_context); @@ -2780,11 +2781,12 @@ } } -static void style_init(struct nk_context *ctx) +static void style_init(uint8_t window, struct nk_context *ctx) { - ctx->style.checkbox.padding.x = render_height() / 120; - ctx->style.checkbox.padding.y = render_height() / 120; - ctx->style.checkbox.border = render_height() / 240; + uint32_t height = window < FRAMEBUFFER_USER_START ? render_height() : 480; + ctx->style.checkbox.padding.x = height / 120; + ctx->style.checkbox.padding.y = height / 120; + ctx->style.checkbox.border = height / 240; ctx->style.checkbox.cursor_normal.type = NK_STYLE_ITEM_COLOR; ctx->style.checkbox.cursor_normal.data.color = (struct nk_color){ .r = 255, .g = 128, .b = 0, .a = 255 @@ -2800,7 +2802,8 @@ static void fb_resize(void) { nk_rawfb_resize_fb(fb_context, NULL, render_width(), render_height(), 0); - style_init(context); + style_init(FRAMEBUFFER_UI, context); + font_init(FRAMEBUFFER_UI, context); texture_init(); } @@ -2912,8 +2915,8 @@ #ifndef DISABLE_OPENGL } #endif - style_init(ret); - font_init(ret); + style_init(window, ret); + font_init(window, ret); return ret; }