ImGuiJs

imguijs.ImGuiJs (Class)

js-target runtime support for the generated bindings (imguijs.ImGui): holds the emscripten-built dcimgui module and the scratch memory used to marshal strings, out-params and small arrays - nothing here allocates garbage per frame (bump offsets into persistent wasm heap blocks).

The module must be loaded and passed to init() before any ImGui call (the ceramic imgui plugin does this at startup).

Static Members

The emscripten module (result of the DCImGui() factory promise).


vecScratch: Int

16-byte block for by-value struct returns (ImVec2/ImVec4/ImTextureRef).


numScratch: Int

64-byte block for scalar out-params (widget macros; 8 bytes per slot).


arrScratchA: Int

Two 16-byte blocks for fixed-size array args (float[2..4], int[2..4]).


arrScratchB: Int

ptrSize: Int

Native pointer size in bytes (wasm32).


init(module: Dynamic): Void
Name Type
module Dynamic

strReset(): Void

Reset the call-scoped string bump region (start of each binding call).


str(s: String): Int

Copy a Haxe string as UTF-8 into the bump region, return its address (0 for null).

Name Type
s String
Returns
Int

u64(v: Float): Dynamic

u64 boundary: wasm i64 params take a BigInt (WASM_BIGINT).

Name Type
v Float
Returns
Dynamic

num64(v: Dynamic): Float

u64 boundary: BigInt result back to a Haxe Float.

Name Type
v Dynamic
Returns
Float

getF32(addr: Int): Float
Name Type
addr Int
Returns
Float

setF32(addr: Int, v: Float): Void
Name Type
addr Int
v Float

getF64(addr: Int): Float
Name Type
addr Int
Returns
Float

setF64(addr: Int, v: Float): Void
Name Type
addr Int
v Float

getI32(addr: Int): Int
Name Type
addr Int
Returns
Int

setI32(addr: Int, v: Int): Void
Name Type
addr Int
v Int

getU32(addr: Int): Int
Name Type
addr Int
Returns
Int

setU32(addr: Int, v: Int): Void
Name Type
addr Int
v Int

getU16(addr: Int): Int
Name Type
addr Int
Returns
Int

getU8(addr: Int): Int
Name Type
addr Int
Returns
Int

setU8(addr: Int, v: Int): Void
Name Type
addr Int
v Int

floatsDyn(values: Array<Float>): Int

Copy a Haxe Array into a persistent native f32 buffer; returns its address.

Name Type
values Array<Float>
Returns
Int

readPtr(addr: Int): Int

Read a native pointer at addr.

Name Type
addr Int
Returns
Int

getU64(addr: Int): Float

Read a u64 at addr as a Haxe Float (registry ids are small: low half wins).

Name Type
addr Int
Returns
Float

strBufPut(s: String, maxLength: Int): Int

Copy s (UTF-8, clamped to maxLength bytes on a codepoint boundary, zero-terminated) into the persistent buffer; returns its address.

Name Type
s String
maxLength Int
Returns
Int

strBufChanged(original: String): Bool

Whether the persistent buffer differs from original (no allocation).

Name Type
original String
Returns
Bool

strBufRead(): String

The persistent buffer content as a Haxe String (allocates - call on change only).

Returns
String

Private Members

strBase: Int

strCap: Int

strOffset: Int

bufBase: Int

bufCap: Int

dynFloats: Int

dynFloatsCap: Int