From: Brendan Hansen Date: Tue, 14 Dec 2021 00:20:11 +0000 (-0600) Subject: fixed stb_truetype X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=45666d6004f7634ff9b05a65dc8075f7c063fd09;p=voxel-shooter.git fixed stb_truetype --- diff --git a/lib/stb_truetype.c b/lib/stb_truetype.c index 0fb24f4..37ddff8 100644 --- a/lib/stb_truetype.c +++ b/lib/stb_truetype.c @@ -19,7 +19,7 @@ static void *__onyx_heap_alloc_wrapper(int size, void* userdata) { static wasm_func_t* heap_free = NULL; static void __onyx_heap_free_wrapper(void *ptr, void* userdata) { - if (heap_alloc == NULL) { + if (heap_free == NULL) { wasm_extern_t *heap_free_extern = runtime->wasm_extern_lookup_by_name(runtime->wasm_module, runtime->wasm_instance, "stbtt_heap_free"); heap_free = runtime->wasm_extern_as_func(heap_free_extern); } @@ -30,7 +30,7 @@ static void __onyx_heap_free_wrapper(void *ptr, void* userdata) { wasm_val_vec_t results = {0,0}; wasm_val_vec_t args_arr = WASM_ARRAY_VEC(args); - runtime->wasm_func_call(heap_alloc, &args_arr, &results); + runtime->wasm_func_call(heap_free, &args_arr, &results); } #define STBTT_malloc __onyx_heap_alloc_wrapper diff --git a/lib/stb_truetype.onyx b/lib/stb_truetype.onyx index 3e5aa73..a40ffd9 100644 --- a/lib/stb_truetype.onyx +++ b/lib/stb_truetype.onyx @@ -17,10 +17,5 @@ stbtt_packedchar :: struct #size 28 { stbtt_PackSetOversampling :: (ctx: ^stbtt_pack_context, h_oversample, v_oversample: i32) -> void --- } -#export "stbtt_heap_alloc" (size: i32) -> rawptr { - return calloc(size); -} - -#export "stbtt_heap_free" (ptr: rawptr) { - cfree(ptr); -} \ No newline at end of file +#export "stbtt_heap_alloc" calloc +#export "stbtt_heap_free" cfree \ No newline at end of file diff --git a/run_tree/assets/calibri.ttf b/run_tree/assets/calibri.ttf new file mode 100644 index 0000000..aac4726 Binary files /dev/null and b/run_tree/assets/calibri.ttf differ diff --git a/run_tree/lib/stb_truetype.dll b/run_tree/lib/stb_truetype.dll index 04a6a9e..37e6b45 100644 Binary files a/run_tree/lib/stb_truetype.dll and b/run_tree/lib/stb_truetype.dll differ