mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
wasm: support more vendor libraries
Adds support for: - box2d - cgltf - stb image - stb rect pack
This commit is contained in:
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
package odin_libc
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
import "core:mem"
|
||||
|
||||
@(private)
|
||||
g_ctx: runtime.Context
|
||||
@(private)
|
||||
g_allocator: mem.Compat_Allocator
|
||||
|
||||
@(init)
|
||||
init_context :: proc() {
|
||||
g_ctx = context
|
||||
|
||||
// Wrapping the allocator with the mem.Compat_Allocator so we can
|
||||
// mimic the realloc semantics.
|
||||
mem.compat_allocator_init(&g_allocator, g_ctx.allocator)
|
||||
g_ctx.allocator = mem.compat_allocator(&g_allocator)
|
||||
}
|
||||
|
||||
// NOTE: the allocator must respect an `old_size` of `-1` on resizes!
|
||||
set_context :: proc(ctx := context) {
|
||||
g_ctx = ctx
|
||||
}
|
||||
Reference in New Issue
Block a user