From 6bed551cc67308761c8f7f4db9d61c3d6df3e0cb Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 13 Nov 2024 17:47:34 +0100 Subject: [PATCH] fix the nuklear samples to use sokol-app mouse cursors --- sapp/nuklear-images-sapp.c | 2 ++ sapp/nuklear-sapp.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/sapp/nuklear-images-sapp.c b/sapp/nuklear-images-sapp.c index b87e5492..ced8ec2f 100644 --- a/sapp/nuklear-images-sapp.c +++ b/sapp/nuklear-images-sapp.c @@ -60,6 +60,7 @@ static void init(void) { }); __dbgui_setup(sapp_sample_count()); snk_setup(&(snk_desc_t){ + .enable_set_mouse_cursor = true, .dpi_scale = sapp_dpi_scale(), .logger.func = slog_func, }); @@ -177,6 +178,7 @@ static void frame(void) { // specific the Nuklear UI (this also just records draw commands which // are then rendered later in the frame in the sokol-gfx default pass) struct nk_context* ctx = snk_new_frame(); + nk_style_hide_cursor(ctx); if (nk_begin(ctx, "Sokol + Nuklear Image Test", nk_rect(10, 10, 540, 570), NK_WINDOW_BORDER|NK_WINDOW_SCALABLE|NK_WINDOW_MOVABLE|NK_WINDOW_MINIMIZABLE)) { nk_layout_row_static(ctx, 256, 256, 2); const struct nk_rect region = { 0, 0, 4, 4 }; diff --git a/sapp/nuklear-sapp.c b/sapp/nuklear-sapp.c index ebb00050..52bcf3fa 100644 --- a/sapp/nuklear-sapp.c +++ b/sapp/nuklear-sapp.c @@ -40,6 +40,7 @@ void init(void) { // use sokol-nuklear with all default-options (we're not doing // multi-sampled rendering or using non-default pixel formats) snk_setup(&(snk_desc_t){ + .enable_set_mouse_cursor = true, .dpi_scale = sapp_dpi_scale(), .logger.func = slog_func, }); @@ -112,6 +113,8 @@ sapp_desc sokol_main(int argc, char* argv[]) { static int draw_demo_ui(struct nk_context *ctx) { + nk_style_hide_cursor(ctx); + /* window flags */ static int show_menu = nk_true; static int titlebar = nk_true;