updates Nuklear.h

Verified that toggle boxes and buttons look good for all SDL, X11, and
GLFW demos. Also respects different styles, which is the biggest change
with the recent merge with master.
This commit is contained in:
Alexander W. Schultz 2024-09-02 15:29:59 -04:00
parent 204888fb3b
commit 7a87b4a11e
1 changed files with 19 additions and 15 deletions

View File

@ -24907,16 +24907,18 @@ nk_draw_checkbox(struct nk_command_buffer *out,
text.padding.y = 0; text.padding.y = 0;
text.background = style->text_background; text.background = style->text_background;
nk_widget_text(out, *label, string, len, &text, text_alignment, font); nk_widget_text(out, *label, string, len, &text, text_alignment, font);
/* draw background and cursor */ /* draw background and cursor */
if (background->type == NK_STYLE_ITEM_COLOR) { if (background->type == NK_STYLE_ITEM_COLOR) {
nk_stroke_rect(out, *selector, 2, 2, background->data.color); 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_white); } else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor));
if (active) { if (active) {
if (cursor->type == NK_STYLE_ITEM_IMAGE) if (cursor->type == NK_STYLE_ITEM_IMAGE)
nk_draw_image(out, *cursors, &cursor->data.image, nk_white); nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor));
else nk_fill_rect(out, *cursors, 0, background->data.color); else nk_fill_rect(out, *cursors, 0, nk_rgb_factor(background->data.color, style->color_factor));
} }
} }
NK_LIB void NK_LIB void
nk_draw_option(struct nk_command_buffer *out, nk_draw_option(struct nk_command_buffer *out,
@ -24944,20 +24946,21 @@ nk_draw_option(struct nk_command_buffer *out,
text.text = style->text_normal; text.text = style->text_normal;
} }
/* draw background and cursor */ text.text = nk_rgb_factor(text.text, style->color_factor);
if (background->type == NK_STYLE_ITEM_COLOR) {
nk_stroke_circle(out, *selector, 2, background->data.color);
} 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, background->data.color);
}
text.padding.x = 0; text.padding.x = 0;
text.padding.y = 0; text.padding.y = 0;
text.background = style->text_background; text.background = style->text_background;
nk_widget_text(out, *label, string, len, &text, NK_TEXT_LEFT, font); nk_widget_text(out, *label, string, len, &text, text_alignment, font);
/* draw background and cursor */
if (background->type == NK_STYLE_ITEM_COLOR) {
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, background->data.color);
}
} }
NK_LIB nk_bool NK_LIB nk_bool
nk_do_toggle(nk_flags *state, nk_do_toggle(nk_flags *state,
@ -30539,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/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/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/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/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.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 /// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than