From d0c22ebf09e5b72c502b4e88da2d88c474f189c4 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 4 Dec 2019 15:38:36 +0100 Subject: [PATCH 1/3] Update nuklear.h --- nuklear.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nuklear.h b/nuklear.h index e847d5e..4378259 100644 --- a/nuklear.h +++ b/nuklear.h @@ -5715,9 +5715,11 @@ template struct nk_alignof{struct Big {T x; char c;}; enum { #ifndef NK_MEMSET #define NK_MEMSET nk_memset +#define NK_DEF_MEMSET #endif #ifndef NK_MEMCPY #define NK_MEMCPY nk_memcopy +#define NK_DEF_MEMCPY #endif #ifndef NK_SQRT #define NK_SQRT nk_sqrt @@ -6333,6 +6335,8 @@ NK_LIB int nk_is_upper(int c){return (c >= 'A' && c <= 'Z') || (c >= 0xC0 && c < NK_LIB int nk_to_upper(int c) {return (c >= 'a' && c <= 'z') ? (c - ('a' - 'A')) : c;} NK_LIB int nk_to_lower(int c) {return (c >= 'A' && c <= 'Z') ? (c - ('a' + 'A')) : c;} +#ifdef NK_DEF_MEMCPY + NK_LIB void* nk_memcopy(void *dst0, const void *src0, nk_size length) { @@ -6389,6 +6393,11 @@ nk_memcopy(void *dst0, const void *src0, nk_size length) done: return (dst0); } + +#endif + +#ifdef NK_DEF_MEMSET + NK_LIB void nk_memset(void *ptr, int c0, nk_size size) { @@ -6440,6 +6449,8 @@ nk_memset(void *ptr, int c0, nk_size size) #undef nk_wsize #undef nk_wmask } +#endif + NK_LIB void nk_zero(void *ptr, nk_size size) { @@ -9436,6 +9447,8 @@ nk_draw_list_alloc_vertices(struct nk_draw_list *list, nk_size count) if (!vtx) return 0; list->vertex_count += (unsigned int)count; + #ifndef NK_UINT_DRAW_INDEX + /* This assert triggers because your are drawing a lot of stuff and nuklear * defined `nk_draw_index` as `nk_ushort` to safe space be default. * @@ -9445,8 +9458,11 @@ nk_draw_list_alloc_vertices(struct nk_draw_list *list, nk_size count) * backend (OpenGL, DirectX, ...). For example in OpenGL for `glDrawElements` * instead of specifing `GL_UNSIGNED_SHORT` you have to define `GL_UNSIGNED_INT`. * Sorry for the inconvenience. */ - if(sizeof(nk_draw_index)==2) NK_ASSERT((list->vertex_count < NK_USHORT_MAX && + NK_ASSERT((list->vertex_count < NK_USHORT_MAX && "To many verticies for 16-bit vertex indicies. Please read comment above on how to solve this problem")); + + #endif + return vtx; } NK_INTERN nk_draw_index* From fb5c1ed9988c65213c240a316e3b8dd706a266fd Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 4 Dec 2019 16:41:37 +0100 Subject: [PATCH 2/3] Added out of the box windows support for packing the file --- Readme.md | 2 +- src/Readme.md | 1 + src/paq.bat | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 src/paq.bat diff --git a/Readme.md b/Readme.md index 118da18..4b674f5 100644 --- a/Readme.md +++ b/Readme.md @@ -120,7 +120,7 @@ Big thank you to Omar Cornut (ocornut@github) for his [imgui](https://github.com giving me the inspiration for this library, Casey Muratori for handmade hero and his original immediate mode graphical user interface idea and Sean Barrett for his amazing single header [libraries](https://github.com/nothings/stb) which restored my faith -in libraries and brought me to create some of my own. Finally Apoorva Joshi for his singe-header [file packer](http://apoorvaj.io/single-header-packer.html). +in libraries and brought me to create some of my own. Finally Apoorva Joshi for his single-header [file packer](http://apoorvaj.io/single-header-packer.html). ## License ``` diff --git a/src/Readme.md b/src/Readme.md index 9fb525e..6a6f284 100644 --- a/src/Readme.md +++ b/src/Readme.md @@ -2,3 +2,4 @@ File Packer: ------------ - [Click to generate nuklear.h](http://apoorvaj.io/single-header-packer.html?macro=NK&pre=https://raw.githubusercontent.com/vurtun/nuklear/master/src/HEADER&pub=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear.h&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_internal.h&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_math.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_util.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_color.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_utf8.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_buffer.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_string.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_draw.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_vertex.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_font.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_input.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_style.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_context.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_pool.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_page_element.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_table.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_panel.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_window.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_popup.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_contextual.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_menu.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_layout.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_tree.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_group.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_list_view.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_widget.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_text.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_image.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_button.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_toggle.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_selectable.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_slider.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_progress.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_scrollbar.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_text_editor.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_edit.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_property.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_chart.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_color_picker.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_combo.c&priv=https://raw.githubusercontent.com/vurtun/nuklear/master/src/nuklear_tooltip.c&post=https://raw.githubusercontent.com/vurtun/nuklear/master/src/LICENSE&post=https://raw.githubusercontent.com/vurtun/nuklear/master/src/CHANGELOG&post=https://raw.githubusercontent.com/vurtun/nuklear/master/src/CREDITS) - On Linux/Mac just run ./paq > ../nuklear.h +- On Windows just run paq.bat diff --git a/src/paq.bat b/src/paq.bat new file mode 100644 index 0000000..f266854 --- /dev/null +++ b/src/paq.bat @@ -0,0 +1 @@ +build.py --macro NK --intro HEADER --pub nuklear.h --priv nuklear_internal.h,nuklear_math.c,nuklear_util.c,nuklear_color.c,nuklear_utf8.c,nuklear_buffer.c,nuklear_string.c,nuklear_draw.c,nuklear_vertex.c,nuklear_font.c,nuklear_input.c,nuklear_style.c,nuklear_context.c,nuklear_pool.c,nuklear_page_element.c,nuklear_table.c,nuklear_panel.c,nuklear_window.c,nuklear_popup.c,nuklear_contextual.c,nuklear_menu.c,nuklear_layout.c,nuklear_tree.c,nuklear_group.c,nuklear_list_view.c,nuklear_widget.c,nuklear_text.c,nuklear_image.c,nuklear_button.c,nuklear_toggle.c,nuklear_selectable.c,nuklear_slider.c,nuklear_progress.c,nuklear_scrollbar.c,nuklear_text_editor.c,nuklear_edit.c,nuklear_property.c,nuklear_chart.c,nuklear_color_picker.c,nuklear_combo.c,nuklear_tooltip.c --outro LICENSE,CHANGELOG,CREDITS > ..\nuklear.h \ No newline at end of file From dcae10480540fc3b79e0641405c6fdd211490120 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 4 Dec 2019 17:14:32 +0100 Subject: [PATCH 3/3] Revert "Update nuklear.h" This reverts commit d0c22ebf09e5b72c502b4e88da2d88c474f189c4. --- nuklear.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/nuklear.h b/nuklear.h index 4378259..e847d5e 100644 --- a/nuklear.h +++ b/nuklear.h @@ -5715,11 +5715,9 @@ template struct nk_alignof{struct Big {T x; char c;}; enum { #ifndef NK_MEMSET #define NK_MEMSET nk_memset -#define NK_DEF_MEMSET #endif #ifndef NK_MEMCPY #define NK_MEMCPY nk_memcopy -#define NK_DEF_MEMCPY #endif #ifndef NK_SQRT #define NK_SQRT nk_sqrt @@ -6335,8 +6333,6 @@ NK_LIB int nk_is_upper(int c){return (c >= 'A' && c <= 'Z') || (c >= 0xC0 && c < NK_LIB int nk_to_upper(int c) {return (c >= 'a' && c <= 'z') ? (c - ('a' - 'A')) : c;} NK_LIB int nk_to_lower(int c) {return (c >= 'A' && c <= 'Z') ? (c - ('a' + 'A')) : c;} -#ifdef NK_DEF_MEMCPY - NK_LIB void* nk_memcopy(void *dst0, const void *src0, nk_size length) { @@ -6393,11 +6389,6 @@ nk_memcopy(void *dst0, const void *src0, nk_size length) done: return (dst0); } - -#endif - -#ifdef NK_DEF_MEMSET - NK_LIB void nk_memset(void *ptr, int c0, nk_size size) { @@ -6449,8 +6440,6 @@ nk_memset(void *ptr, int c0, nk_size size) #undef nk_wsize #undef nk_wmask } -#endif - NK_LIB void nk_zero(void *ptr, nk_size size) { @@ -9447,8 +9436,6 @@ nk_draw_list_alloc_vertices(struct nk_draw_list *list, nk_size count) if (!vtx) return 0; list->vertex_count += (unsigned int)count; - #ifndef NK_UINT_DRAW_INDEX - /* This assert triggers because your are drawing a lot of stuff and nuklear * defined `nk_draw_index` as `nk_ushort` to safe space be default. * @@ -9458,11 +9445,8 @@ nk_draw_list_alloc_vertices(struct nk_draw_list *list, nk_size count) * backend (OpenGL, DirectX, ...). For example in OpenGL for `glDrawElements` * instead of specifing `GL_UNSIGNED_SHORT` you have to define `GL_UNSIGNED_INT`. * Sorry for the inconvenience. */ - NK_ASSERT((list->vertex_count < NK_USHORT_MAX && + if(sizeof(nk_draw_index)==2) NK_ASSERT((list->vertex_count < NK_USHORT_MAX && "To many verticies for 16-bit vertex indicies. Please read comment above on how to solve this problem")); - - #endif - return vtx; } NK_INTERN nk_draw_index*