浏览代码

updated version, added memory allocator

Ron Aaron 5 年之前
父节点
当前提交
5a5048d259
共有 6 个文件被更改,包括 5487 次插入1854 次删除
  1. 5477 1845
      nuklear.h
  2. 1 0
      src/CHANGELOG
  3. 0 5
      src/HEADER
  4. 8 0
      src/nuklear.h
  5. 0 3
      src/nuklear_font.c
  6. 1 1
      src/paq.bat

文件差异内容过多而无法显示
+ 5477 - 1845
nuklear.h


+ 1 - 0
src/CHANGELOG

@@ -8,6 +8,7 @@
 ///    - [yy]: Minor version with non-breaking API and library changes
 ///    - [yy]: Minor version with non-breaking API and library changes
 ///    - [zz]: Bug fix version with no direct changes to API
 ///    - [zz]: Bug fix version with no direct changes to API
 ///
 ///
+/// - 2020/02/06 (4.01.6) - Update stb_truetype.h and stb_rect_pack.h and separate them
 /// - 2019/12/10 (4.01.5) - Fix off-by-one error in NK_INTERSECT
 /// - 2019/12/10 (4.01.5) - Fix off-by-one error in NK_INTERSECT
 /// - 2019/10/09 (4.01.4) - Fix bug for autoscrolling in nk_do_edit
 /// - 2019/10/09 (4.01.4) - Fix bug for autoscrolling in nk_do_edit
 /// - 2019/09/20 (4.01.3) - Fixed a bug wherein combobox cannot be closed by clicking the header
 /// - 2019/09/20 (4.01.3) - Fixed a bug wherein combobox cannot be closed by clicking the header

+ 0 - 5
src/HEADER

@@ -211,8 +211,3 @@
 ///
 ///
 /// ## API
 /// ## API
 ///
 ///
-
-#ifdef NK_IMPLEMENTATION
-#define STB_RECT_PACK_IMPLEMENTATION
-#define STB_TRUETYPE_IMPLEMENTATION
-#endif

+ 8 - 0
src/nuklear.h

@@ -5461,4 +5461,12 @@ template<typename T> struct nk_alignof{struct Big {T x; char c;}; enum {
 #define NK_ALIGNOF(t) ((char*)(&((struct {char c; t _h;}*)0)->_h) - (char*)0)
 #define NK_ALIGNOF(t) ((char*)(&((struct {char c; t _h;}*)0)->_h) - (char*)0)
 #endif
 #endif
 
 
+#ifdef NK_IMPLEMENTATION
+#define STB_RECT_PACK_IMPLEMENTATION
+#define STB_TRUETYPE_IMPLEMENTATION
+#endif
+
+#define STBTT_malloc(x,u) nk_malloc({0},0,x)
+#define STBTT_free(x,u) nk_mfree({0},x)
+
 #endif /* NK_NUKLEAR_H_ */
 #endif /* NK_NUKLEAR_H_ */

+ 0 - 3
src/nuklear_font.c

@@ -304,11 +304,8 @@ nk_font_bake(struct nk_font_baker *baker, void *image_memory, int width, int hei
         do {const struct nk_font_config *cfg = it;
         do {const struct nk_font_config *cfg = it;
             struct nk_font_bake_data *tmp = &baker->build[input_i++];
             struct nk_font_bake_data *tmp = &baker->build[input_i++];
             stbtt_PackSetOversampling(&baker->spc, cfg->oversample_h, cfg->oversample_v);
             stbtt_PackSetOversampling(&baker->spc, cfg->oversample_h, cfg->oversample_v);
-			// TODO:
-            // was: stbtt_PackFontRangesRenderIntoRects(&baker->spc, &tmp->info, tmp->ranges, (int)tmp->range_count, tmp->rects, &baker->alloc);
             stbtt_PackFontRangesRenderIntoRects(&baker->spc, &tmp->info, tmp->ranges, (int)tmp->range_count, tmp->rects);
             stbtt_PackFontRangesRenderIntoRects(&baker->spc, &tmp->info, tmp->ranges, (int)tmp->range_count, tmp->rects);
         } while ((it = it->n) != config_iter);
         } while ((it = it->n) != config_iter);
-		// TODO: was stbtt_PackEnd(&baker->spc, &baker->alloc);
     } stbtt_PackEnd(&baker->spc);
     } stbtt_PackEnd(&baker->spc);
 
 
     /* third pass: setup font and glyphs */
     /* third pass: setup font and glyphs */

+ 1 - 1
src/paq.bat

@@ -1 +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
+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,stb_rect_pack.h,stb_truetype.h,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

部分文件因为文件数量过多而无法显示