Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 2308:b7768c58f0da
Initial stab at DPI scaling support
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 26 Mar 2023 22:39:18 -0700 |
parents | a8080240cb92 |
children | b0ec82a59472 |
comparison
equal
deleted
inserted
replaced
2307:a8080240cb92 | 2308:b7768c58f0da |
---|---|
2325 nk_sdl_shutdown(); | 2325 nk_sdl_shutdown(); |
2326 context = NULL; | 2326 context = NULL; |
2327 } | 2327 } |
2328 } | 2328 } |
2329 | 2329 |
2330 static void fb_resize(void) | |
2331 { | |
2332 nk_rawfb_resize_fb(fb_context, NULL, render_width(), render_height(), 0); | |
2333 } | |
2334 | |
2335 #ifndef DISABLE_OPENGL | 2330 #ifndef DISABLE_OPENGL |
2336 static struct nk_image load_image_texture(uint32_t *buf, uint32_t width, uint32_t height) | 2331 static struct nk_image load_image_texture(uint32_t *buf, uint32_t width, uint32_t height) |
2337 { | 2332 { |
2338 GLuint tex; | 2333 GLuint tex; |
2339 glGenTextures(1, &tex); | 2334 glGenTextures(1, &tex); |
2416 }; | 2411 }; |
2417 context->style.property.dec_button.text_hover = context->style.property.inc_button.text_hover; | 2412 context->style.property.dec_button.text_hover = context->style.property.inc_button.text_hover; |
2418 context->style.combo.button.text_hover = context->style.property.inc_button.text_hover; | 2413 context->style.combo.button.text_hover = context->style.property.inc_button.text_hover; |
2419 } | 2414 } |
2420 | 2415 |
2416 static void fb_resize(void) | |
2417 { | |
2418 nk_rawfb_resize_fb(fb_context, NULL, render_width(), render_height(), 0); | |
2419 style_init(); | |
2420 texture_init(); | |
2421 } | |
2422 | |
2421 static void context_created(void) | 2423 static void context_created(void) |
2422 { | 2424 { |
2423 context = nk_sdl_init(render_get_window()); | 2425 context = nk_sdl_init(render_get_window()); |
2424 nk_sdl_device_create(); | 2426 #ifndef DISABLE_OPENGL |
2427 if (render_has_gl()) { | |
2428 nk_sdl_device_create(); | |
2429 } else { | |
2430 #endif | |
2431 fb_context = nk_rawfb_init(NULL, context, render_width(), render_height(), 0); | |
2432 render_set_ui_fb_resize_handler(fb_resize); | |
2433 #ifndef DISABLE_OPENGL | |
2434 } | |
2435 #endif | |
2425 style_init(); | 2436 style_init(); |
2426 texture_init(); | 2437 texture_init(); |
2427 } | 2438 } |
2428 | 2439 |
2429 void show_pause_menu(void) | 2440 void show_pause_menu(void) |