@@ -3730,7 +3730,10 @@ NK_API int nk_stricmp(const char *s1, const char *s2);
37303730NK_API int nk_stricmpn(const char *s1, const char *s2, int n);
37313731NK_API int nk_strtoi(const char *str, const char **endptr);
37323732NK_API float nk_strtof(const char *str, const char **endptr);
3733+ #ifndef NK_STRTOD
3734+ #define NK_STRTOD nk_strtod
37333735NK_API double nk_strtod(const char *str, const char **endptr);
3736+ #endif
37343737NK_API int nk_strfilter(const char *text, const char *regexp);
37353738NK_API int nk_strmatch_fuzzy_string(char const *str, char const *pattern, int *out_score);
37363739NK_API int nk_strmatch_fuzzy_text(const char *txt, int txt_len, const char *pattern, int *out_score);
@@ -5688,7 +5691,7 @@ template<typename T> struct nk_alignof{struct Big {T x; char c;}; enum {
56885691#ifndef STBTT_malloc
56895692static nk_handle fictional_handle = {0};
56905693
5691- #define STBTT_malloc(x,u) nk_malloc( fictional_handle, 0, x )
5694+ #define STBTT_malloc(x,u) nk_malloc( fictional_handle, 0, x )
56925695#define STBTT_free(x,u) nk_mfree( fictional_handle , x)
56935696#endif
56945697
@@ -5726,28 +5729,6 @@ static nk_handle fictional_handle = {0};
57265729#define NK_ASSERT(expr) assert(expr)
57275730#endif
57285731
5729- #ifndef NK_MEMSET
5730- #define NK_MEMSET nk_memset
5731- #endif
5732- #ifndef NK_MEMCPY
5733- #define NK_MEMCPY nk_memcopy
5734- #endif
5735- #ifndef NK_SQRT
5736- #define NK_SQRT nk_sqrt
5737- #endif
5738- #ifndef NK_SIN
5739- #define NK_SIN nk_sin
5740- #endif
5741- #ifndef NK_COS
5742- #define NK_COS nk_cos
5743- #endif
5744- #ifndef NK_STRTOD
5745- #define NK_STRTOD nk_strtod
5746- #endif
5747- #ifndef NK_DTOA
5748- #define NK_DTOA nk_dtoa
5749- #endif
5750-
57515732#define NK_DEFAULT (-1)
57525733
57535734#ifndef NK_VSNPRINTF
@@ -5810,9 +5791,12 @@ NK_GLOBAL const struct nk_color nk_yellow = {255,255,0,255};
58105791
58115792/* math */
58125793NK_LIB float nk_inv_sqrt(float n);
5813- NK_LIB float nk_sqrt(float x);
5794+ #ifndef NK_SIN
58145795NK_LIB float nk_sin(float x);
5796+ #endif
5797+ #ifndef NK_COS
58155798NK_LIB float nk_cos(float x);
5799+ #endif
58165800NK_LIB nk_uint nk_round_up_pow2(nk_uint v);
58175801NK_LIB struct nk_rect nk_shrink_rect(struct nk_rect r, float amount);
58185802NK_LIB struct nk_rect nk_pad_rect(struct nk_rect r, struct nk_vec2 pad);
@@ -5829,12 +5813,19 @@ NK_LIB int nk_is_lower(int c);
58295813NK_LIB int nk_is_upper(int c);
58305814NK_LIB int nk_to_upper(int c);
58315815NK_LIB int nk_to_lower(int c);
5816+
5817+ #ifndef NK_MEMCPY
58325818NK_LIB void* nk_memcopy(void *dst, const void *src, nk_size n);
5819+ #endif
5820+ #ifndef NK_MEMSET
58335821NK_LIB void nk_memset(void *ptr, int c0, nk_size size);
5822+ #endif
58345823NK_LIB void nk_zero(void *ptr, nk_size size);
58355824NK_LIB char *nk_itoa(char *s, long n);
58365825NK_LIB int nk_string_float_limit(char *string, int prec);
5826+ #ifndef NK_DTOA
58375827NK_LIB char *nk_dtoa(char *s, double n);
5828+ #endif
58385829NK_LIB int nk_text_clamp(const struct nk_user_font *font, const char *text, int text_len, float space, int *glyphs, float *text_width, nk_rune *sep_list, int sep_count);
58395830NK_LIB struct nk_vec2 nk_text_calculate_text_bounds(const struct nk_user_font *font, const char *begin, int byte_len, float row_height, const char **remaining, struct nk_vec2 *out_offset, int *glyphs, int op);
58405831#ifdef NK_INCLUDE_STANDARD_VARARGS
@@ -6079,11 +6070,8 @@ nk_inv_sqrt(float n)
60796070 conv.f = conv.f * (threehalfs - (x2 * conv.f * conv.f));
60806071 return conv.f;
60816072}
6082- NK_LIB float
6083- nk_sqrt(float x)
6084- {
6085- return x * nk_inv_sqrt(x);
6086- }
6073+ #ifndef NK_SIN
6074+ #define NK_SIN nk_sin
60876075NK_LIB float
60886076nk_sin(float x)
60896077{
@@ -6097,6 +6085,9 @@ nk_sin(float x)
60976085 NK_STORAGE const float a7 = +1.38235642404333740e-4f;
60986086 return a0 + x*(a1 + x*(a2 + x*(a3 + x*(a4 + x*(a5 + x*(a6 + x*a7))))));
60996087}
6088+ #endif
6089+ #ifndef NK_COS
6090+ #define NK_COS nk_cos
61006091NK_LIB float
61016092nk_cos(float x)
61026093{
@@ -6113,6 +6104,7 @@ nk_cos(float x)
61136104 NK_STORAGE const float a8 = -1.8776444013090451e-5f;
61146105 return a0 + x*(a1 + x*(a2 + x*(a3 + x*(a4 + x*(a5 + x*(a6 + x*(a7 + x*a8)))))));
61156106}
6107+ #endif
61166108NK_LIB nk_uint
61176109nk_round_up_pow2(nk_uint v)
61186110{
@@ -6346,6 +6338,8 @@ NK_LIB int nk_is_upper(int c){return (c >= 'A' && c <= 'Z') || (c >= 0xC0 && c <
63466338NK_LIB int nk_to_upper(int c) {return (c >= 'a' && c <= 'z') ? (c - ('a' - 'A')) : c;}
63476339NK_LIB int nk_to_lower(int c) {return (c >= 'A' && c <= 'Z') ? (c - ('a' + 'A')) : c;}
63486340
6341+ #ifndef NK_MEMCPY
6342+ #define NK_MEMCPY nk_memcopy
63496343NK_LIB void*
63506344nk_memcopy(void *dst0, const void *src0, nk_size length)
63516345{
@@ -6402,6 +6396,9 @@ nk_memcopy(void *dst0, const void *src0, nk_size length)
64026396done:
64036397 return (dst0);
64046398}
6399+ #endif
6400+ #ifndef NK_MEMSET
6401+ #define NK_MEMSET nk_memset
64056402NK_LIB void
64066403nk_memset(void *ptr, int c0, nk_size size)
64076404{
@@ -6453,6 +6450,7 @@ nk_memset(void *ptr, int c0, nk_size size)
64536450 #undef nk_wsize
64546451 #undef nk_wmask
64556452}
6453+ #endif
64566454NK_LIB void
64576455nk_zero(void *ptr, nk_size size)
64586456{
@@ -6826,6 +6824,8 @@ nk_itoa(char *s, long n)
68266824 nk_strrev_ascii(s);
68276825 return s;
68286826}
6827+ #ifndef NK_DTOA
6828+ #define NK_DTOA nk_dtoa
68296829NK_LIB char*
68306830nk_dtoa(char *s, double n)
68316831{
@@ -6904,6 +6904,7 @@ nk_dtoa(char *s, double n)
69046904 *(c) = '\0';
69056905 return s;
69066906}
6907+ #endif
69076908#ifdef NK_INCLUDE_STANDARD_VARARGS
69086909#ifndef NK_INCLUDE_STANDARD_IO
69096910NK_INTERN int
@@ -22185,7 +22186,6 @@ nk_tree_element_image_push_hashed_base(struct nk_context *ctx, enum nk_tree_type
2218522186 struct nk_vec2 item_spacing;
2218622187 struct nk_rect header = {0,0,0,0};
2218722188 struct nk_rect sym = {0,0,0,0};
22188- struct nk_text text;
2218922189
2219022190 nk_flags ws = 0;
2219122191 enum nk_widget_layout_states widget_state;
@@ -22215,14 +22215,12 @@ nk_tree_element_image_push_hashed_base(struct nk_context *ctx, enum nk_tree_type
2221522215 const struct nk_style_item *background = &style->tab.background;
2221622216 if (background->type == NK_STYLE_ITEM_IMAGE) {
2221722217 nk_draw_image(out, header, &background->data.image, nk_white);
22218- text.background = nk_rgba(0,0,0,0);
2221922218 } else {
22220- text.background = background->data.color;
2222122219 nk_fill_rect(out, header, 0, style->tab.border_color);
2222222220 nk_fill_rect(out, nk_shrink_rect(header, style->tab.border),
2222322221 style->tab.rounding, background->data.color);
2222422222 }
22225- } else text.background = style->window.background;
22223+ }
2222622224
2222722225 in = (!(layout->flags & NK_WINDOW_ROM)) ? &ctx->input: 0;
2222822226 in = (in && widget_state == NK_WIDGET_VALID) ? &ctx->input : 0;
@@ -29095,6 +29093,9 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
2909529093/// - [yy]: Minor version with non-breaking API and library changes
2909629094/// - [zz]: Bug fix version with no direct changes to API
2909729095///
29096+ /// - 2020/04/09 (4.02.1) - Removed unused nk_sqrt function to fix compiler warnings
29097+ /// - Fixed compiler warnings if you bring your own methods for
29098+ /// nk_cos/nk_sin/nk_strtod/nk_memset/nk_memcopy/nk_dtoa
2909829099/// - 2020/04/06 (4.01.10) - Fix bug: Do not use pool before checking for NULL
2909929100/// - 2020/03/22 (4.01.9) - Fix bug where layout state wasn't restored correctly after
2910029101/// popping a tree.
0 commit comments