Skip to content

Commit

Permalink
fix the nuklear samples to use sokol-app mouse cursors
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Nov 13, 2024
1 parent d1f7f2d commit 6bed551
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sapp/nuklear-images-sapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -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 };
Expand Down
3 changes: 3 additions & 0 deletions sapp/nuklear-sapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6bed551

Please sign in to comment.