Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuklear",
"version": "4.13.3",
"version": "4.13.4",
"repo": "Immediate-Mode-UI/Nuklear",
"description": "A small ANSI C gui toolkit",
"keywords": ["gl", "ui", "toolkit"],
Expand Down
24 changes: 13 additions & 11 deletions demo/common/overview.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ overview(struct nk_context *ctx)
const float values[]={26.0f,13.0f,30.0f,15.0f,25.0f,10.0f,20.0f,40.0f,12.0f,8.0f,22.0f,28.0f};
menu_state = MENU_CHART;
nk_layout_row_dynamic(ctx, 150, 1);
nk_chart_begin(ctx, NK_CHART_COLUMN, NK_LEN(values), 0, 50);
for (i = 0; i < NK_LEN(values); ++i)
nk_chart_push(ctx, values[i]);
nk_chart_end(ctx);
if (nk_chart_begin(ctx, NK_CHART_COLUMN, NK_LEN(values), 0, 50)) {
for (i = 0; i < NK_LEN(values); ++i)
nk_chart_push(ctx, values[i]);
nk_chart_end(ctx);
}
nk_tree_pop(ctx);
} else menu_state = (menu_state == MENU_CHART) ? MENU_NONE: menu_state;
nk_menu_end(ctx);
Expand Down Expand Up @@ -491,15 +492,16 @@ overview(struct nk_context *ctx)
size_t i = 0;
static const float values[]={26.0f,13.0f,30.0f,15.0f,25.0f,10.0f,20.0f,40.0f, 12.0f, 8.0f, 22.0f, 28.0f, 5.0f};
nk_layout_row_dynamic(ctx, 150, 1);
nk_chart_begin(ctx, NK_CHART_COLUMN, NK_LEN(values), 0, 50);
for (i = 0; i < NK_LEN(values); ++i) {
nk_flags res = nk_chart_push(ctx, values[i]);
if (res & NK_CHART_CLICKED) {
chart_selection = values[i];
nk_combo_close(ctx);
if (nk_chart_begin(ctx, NK_CHART_COLUMN, NK_LEN(values), 0, 50)) {
for (i = 0; i < NK_LEN(values); ++i) {
nk_flags res = nk_chart_push(ctx, values[i]);
if (res & NK_CHART_CLICKED) {
chart_selection = values[i];
nk_combo_close(ctx);
}
}
nk_chart_end(ctx);
}
nk_chart_end(ctx);
nk_combo_end(ctx);
}

Expand Down
4 changes: 4 additions & 0 deletions demo/glfw_opengl4/nuklear_glfw_gl4.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state init_state,
glfw.ctx.clip.copy = nk_glfw3_clipboard_copy;
glfw.ctx.clip.paste = nk_glfw3_clipboard_paste;
glfw.ctx.clip.userdata = nk_handle_ptr(0);
glfwGetWindowSize(win, &glfw.width, &glfw.height);
nk_set_display_size(&glfw.ctx, (float)glfw.width, (float)glfw.height);
glfw.last_button_click = 0;

{struct nk_glfw_device *dev = &glfw.ogl;
Expand Down Expand Up @@ -608,6 +610,8 @@ nk_glfw3_new_frame(void)
glfwGetFramebufferSize(win, &glfw.display_width, &glfw.display_height);
glfw.fb_scale.x = (float)glfw.display_width/(float)glfw.width;
glfw.fb_scale.y = (float)glfw.display_height/(float)glfw.height;
/* logical window size, not framebuffer size */
nk_set_display_size(ctx, (float)glfw.width, (float)glfw.height);

nk_input_begin(ctx);
for (i = 0; i < glfw.text_len; ++i)
Expand Down
2 changes: 2 additions & 0 deletions demo/rawfb/nuklear_rawfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ nk_rawfb_init(void *fb, void *tex_mem, const unsigned int w, const unsigned int
free(rawfb);
return NULL;
}
nk_set_display_size(&rawfb->ctx, (float)w, (float)h);

nk_font_atlas_init_default(&rawfb->atlas);
nk_font_atlas_begin(&rawfb->atlas);
Expand Down Expand Up @@ -1025,6 +1026,7 @@ nk_rawfb_resize_fb(struct rawfb_context *rawfb,
rawfb->fb.pixels = fb;
rawfb->fb.pitch = pitch;
rawfb->fb.pl = pl;
nk_set_display_size(&rawfb->ctx, (float)w, (float)h);
}

NK_API void
Expand Down
7 changes: 7 additions & 0 deletions demo/sdl3_renderer/nuklear_sdl3_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ nk_sdl_init(SDL_Window *win, SDL_Renderer *renderer, struct nk_allocator allocat
sdl->win = win;
sdl->renderer = renderer;
nk_init(&sdl->ctx, &sdl->allocator, 0);
{int dw = 0, dh = 0;
if (SDL_GetWindowSize(win, &dw, &dh))
nk_set_display_size(&sdl->ctx, (float)dw, (float)dh);}
sdl->ctx.userdata = nk_handle_ptr((void*)sdl);
sdl->ctx.clip.copy = nk_sdl_clipboard_copy;
sdl->ctx.clip.paste = nk_sdl_clipboard_paste;
Expand Down Expand Up @@ -564,6 +567,10 @@ nk_sdl_handle_event(struct nk_context* ctx, SDL_Event *evt)
case SDL_EVENT_MOUSE_WHEEL:
nk_input_scroll(ctx, nk_vec2(evt->wheel.x, evt->wheel.y));
return 1;

case SDL_EVENT_WINDOW_RESIZED:
nk_set_display_size(ctx, (float)evt->window.data1, (float)evt->window.data2);
return 1;
}
return 0;
}
Expand Down
Loading
Loading