diff --git a/nuklear.h b/nuklear.h index ecc43184..c8706231 100644 --- a/nuklear.h +++ b/nuklear.h @@ -5936,7 +5936,7 @@ NK_LIB void nk_draw_button_image(struct nk_command_buffer *out, const struct nk_ NK_LIB int nk_do_button_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, enum nk_button_behavior b, const struct nk_style_button *style, const struct nk_input *in); NK_LIB void nk_draw_button_text_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *symbol, nk_flags state, const struct nk_style_button *style, const char *str, int len, enum nk_symbol_type type, const struct nk_user_font *font); NK_LIB int nk_do_button_text_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, const char *str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in); -NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img); +NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img, nk_flags text_alignment); NK_LIB int nk_do_button_text_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, const char* str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in); /* toggle */ @@ -20002,7 +20002,7 @@ nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, - const struct nk_image *img) + const struct nk_image *img, nk_flags text_alignment) { struct nk_text text; const struct nk_style_item *background; @@ -20019,7 +20019,7 @@ nk_draw_button_text_image(struct nk_command_buffer *out, else text.text = style->text_normal; text.padding = nk_vec2(0,0); - nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font); + nk_widget_text(out, *label, str, len, &text, text_alignment, font); nk_draw_image(out, *image, img, nk_white); } NK_LIB int @@ -20054,7 +20054,7 @@ nk_do_button_text_image(nk_flags *state, icon.h -= 2 * style->image_padding.y; if (style->draw_begin) style->draw_begin(out, style->userdata); - nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img); + nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img, align); if (style->draw_end) style->draw_end(out, style->userdata); return ret; } diff --git a/package.json b/package.json index edff9246..cdbbdb0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuklear", - "version": "1.0.0", + "version": "1.0.1", "repo": "vurtun/nuklear", "description": "A small ANSI C gui toolkit", "keywords": ["gl", "ui", "toolkit"], diff --git a/src/CHANGELOG b/src/CHANGELOG index 4edf8efd..a6b280ee 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -8,6 +8,7 @@ /// - [yy]: Minor version with non-breaking API and library changes /// - [zz]: Bug fix version with no direct changes to API /// +/// - 2019/08/15 (4.01.1) - Text alignment respected when doint nk_button_image_label() /// - 2019/06/23 (4.01.0) - Added nk_***_get_scroll and nk_***_set_scroll for groups, windows, and popups /// - 2019/06/12 (4.00.3) - Fix panel background drawing bug /// - 2018/10/31 (4.00.2) - Added NK_KEYSTATE_BASED_INPUT to "fix" state based backends diff --git a/src/nuklear_button.c b/src/nuklear_button.c index e40b2526..e2a140aa 100644 --- a/src/nuklear_button.c +++ b/src/nuklear_button.c @@ -327,7 +327,7 @@ nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, - const struct nk_image *img) + const struct nk_image *img, nk_flags text_alignment) { struct nk_text text; const struct nk_style_item *background; @@ -344,7 +344,7 @@ nk_draw_button_text_image(struct nk_command_buffer *out, else text.text = style->text_normal; text.padding = nk_vec2(0,0); - nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font); + nk_widget_text(out, *label, str, len, &text, text_alignment, font); nk_draw_image(out, *image, img, nk_white); } NK_LIB int @@ -379,7 +379,7 @@ nk_do_button_text_image(nk_flags *state, icon.h -= 2 * style->image_padding.y; if (style->draw_begin) style->draw_begin(out, style->userdata); - nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img); + nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img, align); if (style->draw_end) style->draw_end(out, style->userdata); return ret; } diff --git a/src/nuklear_internal.h b/src/nuklear_internal.h index 5aac1708..0ebddfc1 100644 --- a/src/nuklear_internal.h +++ b/src/nuklear_internal.h @@ -251,7 +251,7 @@ NK_LIB void nk_draw_button_image(struct nk_command_buffer *out, const struct nk_ NK_LIB int nk_do_button_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, enum nk_button_behavior b, const struct nk_style_button *style, const struct nk_input *in); NK_LIB void nk_draw_button_text_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *symbol, nk_flags state, const struct nk_style_button *style, const char *str, int len, enum nk_symbol_type type, const struct nk_user_font *font); NK_LIB int nk_do_button_text_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, const char *str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in); -NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img); +NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img, nk_flags text_alignment); NK_LIB int nk_do_button_text_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, const char* str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in); /* toggle */