diff --git a/demo/x11/nuklear_xlib.h b/demo/x11/nuklear_xlib.h index 0a80ab49e..0d025c791 100644 --- a/demo/x11/nuklear_xlib.h +++ b/demo/x11/nuklear_xlib.h @@ -927,8 +927,8 @@ nk_xlib_render(Drawable screen, struct nk_color clear) } break; case NK_COMMAND_RECT: { const struct nk_command_rect *r = (const struct nk_command_rect *)cmd; - nk_xsurf_stroke_rect(surf, r->x, r->y, NK_MAX(r->w -r->line_thickness, 0), - NK_MAX(r->h - r->line_thickness, 0), (unsigned short)r->rounding, + nk_xsurf_stroke_rect(surf, r->x, r->y, r->w, + r->h, (unsigned short)r->rounding, r->line_thickness, r->color); } break; case NK_COMMAND_RECT_FILLED: { diff --git a/demo/x11_xft/nuklear_xlib.h b/demo/x11_xft/nuklear_xlib.h index 1931828b0..481c3cc48 100644 --- a/demo/x11_xft/nuklear_xlib.h +++ b/demo/x11_xft/nuklear_xlib.h @@ -1012,8 +1012,8 @@ nk_xlib_render(Drawable screen, struct nk_color clear) } break; case NK_COMMAND_RECT: { const struct nk_command_rect *r = (const struct nk_command_rect *)cmd; - nk_xsurf_stroke_rect(surf, r->x, r->y, NK_MAX(r->w -r->line_thickness, 0), - NK_MAX(r->h - r->line_thickness, 0), (unsigned short)r->rounding, + nk_xsurf_stroke_rect(surf, r->x, r->y, r->w, + r->h, (unsigned short)r->rounding, r->line_thickness, r->color); } break; case NK_COMMAND_RECT_FILLED: { diff --git a/nuklear.h b/nuklear.h index 44e29655f..0e8c255f3 100644 --- a/nuklear.h +++ b/nuklear.h @@ -18669,10 +18669,10 @@ nk_style_from_table(struct nk_context *ctx, const struct nk_color *table) toggle->text_normal = table[NK_COLOR_TEXT]; toggle->text_hover = table[NK_COLOR_TEXT]; toggle->text_active = table[NK_COLOR_TEXT]; - toggle->padding = nk_vec2(2.0f, 2.0f); + toggle->padding = nk_vec2(1.0f, 1.0f); toggle->touch_padding = nk_vec2(0,0); toggle->border_color = nk_rgba(0,0,0,0); - toggle->border = 0.0f; + toggle->border = 1.0f; toggle->spacing = 4; toggle->color_factor = 1.0f; toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR; @@ -18690,10 +18690,10 @@ nk_style_from_table(struct nk_context *ctx, const struct nk_color *table) toggle->text_normal = table[NK_COLOR_TEXT]; toggle->text_hover = table[NK_COLOR_TEXT]; toggle->text_active = table[NK_COLOR_TEXT]; - toggle->padding = nk_vec2(3.0f, 3.0f); + toggle->padding = nk_vec2(1.0f, 1.0f); toggle->touch_padding = nk_vec2(0,0); toggle->border_color = nk_rgba(0,0,0,0); - toggle->border = 0.0f; + toggle->border = 1.0f; toggle->spacing = 4; toggle->color_factor = 1.0f; toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR; @@ -25073,13 +25073,14 @@ nk_draw_checkbox(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_fill_rect(out, *selector, 0, nk_rgb_factor(style->border_color, style->color_factor)); - nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, nk_rgb_factor(background->data.color, style->color_factor)); + nk_stroke_rect(out, *selector, 0, style->border, nk_rgb_factor(background->data.color, style->color_factor)); } else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor)); + + /* active state */ if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor)); - else nk_fill_rect(out, *cursors, 0, cursor->data.color); + else nk_fill_rect(out, *cursors, 0, nk_rgb_factor(background->data.color, style->color_factor)); } } NK_LIB void @@ -25116,13 +25117,14 @@ nk_draw_option(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_fill_circle(out, *selector, nk_rgb_factor(style->border_color, style->color_factor)); - nk_fill_circle(out, nk_shrink_rect(*selector, style->border), nk_rgb_factor(background->data.color, style->color_factor)); + nk_stroke_circle(out, *selector, style->border, nk_rgb_factor(background->data.color, style->color_factor)); } else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor)); + + /* active state */ if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor)); - else nk_fill_circle(out, *cursors, cursor->data.color); + else nk_fill_circle(out, *cursors, background->data.color); } } NK_LIB nk_bool @@ -30704,6 +30706,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// - 2022/12/23 (4.10.6) - Fix incorrect glyph index in nk_font_bake() /// - 2022/12/17 (4.10.5) - Fix nk_font_bake_pack() using TTC font offset incorrectly /// - 2022/10/24 (4.10.4) - Fix nk_str_{append,insert}_str_utf8 always returning 0 +/// - 2022/10/03 (4.10.4) - Updated the look and feel of checkboxes and radio buttons to be more distinguishable /// - 2022/09/03 (4.10.3) - Renamed the `null` texture variable to `tex_null` /// - 2022/08/01 (4.10.2) - Fix Apple Silicon with incorrect NK_SITE_TYPE and NK_POINTER_TYPE /// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than diff --git a/src/CHANGELOG b/src/CHANGELOG index c301e319d..014361b6e 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -13,6 +13,7 @@ /// - 2022/12/23 (4.10.6) - Fix incorrect glyph index in nk_font_bake() /// - 2022/12/17 (4.10.5) - Fix nk_font_bake_pack() using TTC font offset incorrectly /// - 2022/10/24 (4.10.4) - Fix nk_str_{append,insert}_str_utf8 always returning 0 +/// - 2022/10/03 (4.10.4) - Updated the look and feel of checkboxes and radio buttons to be more distinguishable /// - 2022/09/03 (4.10.3) - Renamed the `null` texture variable to `tex_null` /// - 2022/08/01 (4.10.2) - Fix Apple Silicon with incorrect NK_SITE_TYPE and NK_POINTER_TYPE /// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than diff --git a/src/nuklear_style.c b/src/nuklear_style.c index 377836a4a..89e8338e4 100644 --- a/src/nuklear_style.c +++ b/src/nuklear_style.c @@ -204,10 +204,10 @@ nk_style_from_table(struct nk_context *ctx, const struct nk_color *table) toggle->text_normal = table[NK_COLOR_TEXT]; toggle->text_hover = table[NK_COLOR_TEXT]; toggle->text_active = table[NK_COLOR_TEXT]; - toggle->padding = nk_vec2(2.0f, 2.0f); + toggle->padding = nk_vec2(1.0f, 1.0f); toggle->touch_padding = nk_vec2(0,0); toggle->border_color = nk_rgba(0,0,0,0); - toggle->border = 0.0f; + toggle->border = 1.0f; toggle->spacing = 4; toggle->color_factor = 1.0f; toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR; @@ -225,10 +225,10 @@ nk_style_from_table(struct nk_context *ctx, const struct nk_color *table) toggle->text_normal = table[NK_COLOR_TEXT]; toggle->text_hover = table[NK_COLOR_TEXT]; toggle->text_active = table[NK_COLOR_TEXT]; - toggle->padding = nk_vec2(3.0f, 3.0f); + toggle->padding = nk_vec2(1.0f, 1.0f); toggle->touch_padding = nk_vec2(0,0); toggle->border_color = nk_rgba(0,0,0,0); - toggle->border = 0.0f; + toggle->border = 1.0f; toggle->spacing = 4; toggle->color_factor = 1.0f; toggle->disabled_factor = NK_WIDGET_DISABLED_FACTOR; diff --git a/src/nuklear_toggle.c b/src/nuklear_toggle.c index cb9e56ac6..5e1824b8b 100644 --- a/src/nuklear_toggle.c +++ b/src/nuklear_toggle.c @@ -55,13 +55,14 @@ nk_draw_checkbox(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_fill_rect(out, *selector, 0, nk_rgb_factor(style->border_color, style->color_factor)); - nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, nk_rgb_factor(background->data.color, style->color_factor)); + nk_stroke_rect(out, *selector, 0, style->border, nk_rgb_factor(background->data.color, style->color_factor)); } else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor)); + + /* active state */ if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor)); - else nk_fill_rect(out, *cursors, 0, cursor->data.color); + else nk_fill_rect(out, *cursors, 0, nk_rgb_factor(background->data.color, style->color_factor)); } } NK_LIB void @@ -98,13 +99,14 @@ nk_draw_option(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_fill_circle(out, *selector, nk_rgb_factor(style->border_color, style->color_factor)); - nk_fill_circle(out, nk_shrink_rect(*selector, style->border), nk_rgb_factor(background->data.color, style->color_factor)); + nk_stroke_circle(out, *selector, style->border, nk_rgb_factor(background->data.color, style->color_factor)); } else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor)); + + /* active state */ if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor)); - else nk_fill_circle(out, *cursors, cursor->data.color); + else nk_fill_circle(out, *cursors, background->data.color); } } NK_LIB nk_bool