From 64b530f89c63ffce7c8e72005f5f1af41ac40d20 Mon Sep 17 00:00:00 2001 From: Robert Lemmens Date: Fri, 17 Jun 2022 13:03:31 +0200 Subject: [PATCH 1/4] update checkbox and radio look and feel --- nuklear.h | 14 ++++++++------ src/nuklear_toggle.c | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/nuklear.h b/nuklear.h index aef8f7fe9..f2dafd3f1 100644 --- a/nuklear.h +++ b/nuklear.h @@ -24434,13 +24434,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, style->border_color); - nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, background->data.color); +// nk_fill_rect(out, *selector, 0, style->border_color); +// nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, background->data.color); + nk_stroke_rect(out, *selector, 2, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_white); - else nk_fill_rect(out, *cursors, 0, cursor->data.color); + else nk_fill_rect(out, *cursors, 0, background->data.color); } text.padding.x = 0; @@ -24476,13 +24477,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, style->border_color); - nk_fill_circle(out, nk_shrink_rect(*selector, style->border), background->data.color); +// nk_fill_circle(out, *selector, style->border_color); +// nk_fill_circle(out, nk_shrink_rect(*selector, style->border), background->data.color); + nk_stroke_circle(out, *selector, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_white); - else nk_fill_circle(out, *cursors, cursor->data.color); + else nk_fill_circle(out, *cursors, background->data.color); } text.padding.x = 0; diff --git a/src/nuklear_toggle.c b/src/nuklear_toggle.c index 0644a8078..123a40d64 100644 --- a/src/nuklear_toggle.c +++ b/src/nuklear_toggle.c @@ -49,13 +49,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, style->border_color); - nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, background->data.color); +// nk_fill_rect(out, *selector, 0, style->border_color); +// nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, background->data.color); + nk_stroke_rect(out, *selector, 2, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_white); - else nk_fill_rect(out, *cursors, 0, cursor->data.color); + else nk_fill_rect(out, *cursors, 0, background->data.color); } text.padding.x = 0; @@ -91,13 +92,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, style->border_color); - nk_fill_circle(out, nk_shrink_rect(*selector, style->border), background->data.color); +// nk_fill_circle(out, *selector, style->border_color); +// nk_fill_circle(out, nk_shrink_rect(*selector, style->border), background->data.color); + nk_stroke_circle(out, *selector, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) nk_draw_image(out, *cursors, &cursor->data.image, nk_white); - else nk_fill_circle(out, *cursors, cursor->data.color); + else nk_fill_circle(out, *cursors, background->data.color); } text.padding.x = 0; From 8491451f34862d532b9dc200ecbcf22a3160bbf8 Mon Sep 17 00:00:00 2001 From: Robert Lemmens Date: Fri, 17 Jun 2022 13:25:08 +0200 Subject: [PATCH 2/4] cleanup commented code --- nuklear.h | 4 ---- src/nuklear_toggle.c | 4 ---- 2 files changed, 8 deletions(-) diff --git a/nuklear.h b/nuklear.h index f2dafd3f1..421047107 100644 --- a/nuklear.h +++ b/nuklear.h @@ -24434,8 +24434,6 @@ 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, style->border_color); -// nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, background->data.color); nk_stroke_rect(out, *selector, 2, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { @@ -24477,8 +24475,6 @@ nk_draw_option(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { -// nk_fill_circle(out, *selector, style->border_color); -// nk_fill_circle(out, nk_shrink_rect(*selector, style->border), background->data.color); nk_stroke_circle(out, *selector, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { diff --git a/src/nuklear_toggle.c b/src/nuklear_toggle.c index 123a40d64..f03adda8f 100644 --- a/src/nuklear_toggle.c +++ b/src/nuklear_toggle.c @@ -49,8 +49,6 @@ 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, style->border_color); -// nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, background->data.color); nk_stroke_rect(out, *selector, 2, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { @@ -92,8 +90,6 @@ nk_draw_option(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { -// nk_fill_circle(out, *selector, style->border_color); -// nk_fill_circle(out, nk_shrink_rect(*selector, style->border), background->data.color); nk_stroke_circle(out, *selector, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { From 481b77df5202814216b64d5a099e0eeac152ad81 Mon Sep 17 00:00:00 2001 From: Robert Lemmens Date: Fri, 17 Jun 2022 13:30:01 +0200 Subject: [PATCH 3/4] update the indentation --- nuklear.h | 4 ++-- src/nuklear_toggle.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nuklear.h b/nuklear.h index 421047107..60ab0d59f 100644 --- a/nuklear.h +++ b/nuklear.h @@ -24434,7 +24434,7 @@ nk_draw_checkbox(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_stroke_rect(out, *selector, 2, 2, background->data.color); + nk_stroke_rect(out, *selector, 2, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) @@ -24475,7 +24475,7 @@ nk_draw_option(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_stroke_circle(out, *selector, 2, background->data.color); + nk_stroke_circle(out, *selector, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) diff --git a/src/nuklear_toggle.c b/src/nuklear_toggle.c index f03adda8f..94af497b0 100644 --- a/src/nuklear_toggle.c +++ b/src/nuklear_toggle.c @@ -49,7 +49,7 @@ nk_draw_checkbox(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_stroke_rect(out, *selector, 2, 2, background->data.color); + nk_stroke_rect(out, *selector, 2, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) @@ -90,7 +90,7 @@ nk_draw_option(struct nk_command_buffer *out, /* draw background and cursor */ if (background->type == NK_STYLE_ITEM_COLOR) { - nk_stroke_circle(out, *selector, 2, background->data.color); + nk_stroke_circle(out, *selector, 2, background->data.color); } else nk_draw_image(out, *selector, &background->data.image, nk_white); if (active) { if (cursor->type == NK_STYLE_ITEM_IMAGE) From b82119178534ff9121f0552a4ad0950d4b1cdad0 Mon Sep 17 00:00:00 2001 From: Robert Lemmens Date: Fri, 17 Jun 2022 13:36:54 +0200 Subject: [PATCH 4/4] update changelog --- src/CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CHANGELOG b/src/CHANGELOG index 44223af14..c2b148cde 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -7,6 +7,7 @@ /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// +/// - 2022/06/17 (4.10.1) - Updated the look and feel of checkboxes and radio buttons to be more distinguishable /// - 2022/05/27 (4.10.0) - Add nk_input_has_mouse_click_in_button_rect() to fix window move bug /// - 2022/04/18 (4.9.7) - Change button behavior when NK_BUTTON_TRIGGER_ON_RELEASE is defined to /// only trigger when the mouse position was inside the same button on down