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 19553b418..7d5503e4f 100644 --- a/nuklear.h +++ b/nuklear.h @@ -24907,17 +24907,18 @@ nk_draw_checkbox(struct nk_command_buffer *out, text.padding.y = 0; text.background = style->text_background; nk_widget_text(out, *label, string, len, &text, text_alignment, font); - + /* 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, 2, 2, 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)); 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 nk_draw_option(struct nk_command_buffer *out, @@ -24953,13 +24954,12 @@ 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, 2, 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)); 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 @@ -30542,6 +30542,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_toggle.c b/src/nuklear_toggle.c index cb9e56ac6..188e44129 100644 --- a/src/nuklear_toggle.c +++ b/src/nuklear_toggle.c @@ -31,6 +31,12 @@ nk_draw_checkbox(struct nk_command_buffer *out, const struct nk_style_item *background; const struct nk_style_item *cursor; struct nk_text text; + struct nk_rect toggle_active_box = *cursors; + toggle_active_box.x += 1; + toggle_active_box.y += 1; + toggle_active_box.w -= 2; + toggle_active_box.h -= 2; + /* select correct colors/images */ if (state & NK_WIDGET_STATE_HOVER) { @@ -52,17 +58,18 @@ nk_draw_checkbox(struct nk_command_buffer *out, text.padding.y = 0; text.background = style->text_background; nk_widget_text(out, *label, string, len, &text, text_alignment, font); - + /* 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, 2, 0, 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)); 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, toggle_active_box, 0, nk_rgb_factor(background->data.color, style->color_factor)); } + + } NK_LIB void nk_draw_option(struct nk_command_buffer *out, @@ -98,13 +105,12 @@ 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, 2, 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)); 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