NativeStructs
imgui.NativeStructs (Class)
Portable creation of the few ImGui helper structs that user code owns
(the generator binds their fields and member functions, but cannot emit
constructors: C++ ctor semantics are replicated here per target).
Also provides raw native memory helpers for the rare APIs taking a
buffer + size (drag and drop payloads, polyline points...).
Static Members
Allocate an ImGuiListClipper (C++ ctor semantics in imgui 1.92: plain
zeroing). Destroy it with destroyListClipper when done, or keep one
per call site for its lifetime (clippers are reusable).
Create an ImGuiSelectionBasicStorage. adapter is the index-to-storage-id
function pointer (use imgui.ImGuiCallbacks.selectionAdapter to install a
Haxe handler); the C++ constructor installs an identity adapter, but the
bindings replicate the ctor per target so the adapter is always set here.
Allocate an ImFontConfig (C++ ctor semantics replicated per target:
fontDataOwnedByAtlas=true, glyphMaxAdvanceX=FLT_MAX, rasterizer
multiply/density=1). Destroy it with destroyFontConfig when done
(the atlas copies the config during AddFont* calls).
Allocate native bytes and copy a haxe.io.Bytes into them (fast per
target: memcpy / HEAPU8.set / Marshal.Copy). Suited to font files and
other large blobs. The returned buffer is never freed automatically.
For a blob an ImGui struct takes OWNERSHIP of, use
allocImGuiBytesFromHaxe instead: ImGui releases what it owns with
IM_FREE, which only pairs with its own allocator.
Same, but allocated with IMGUI'S OWN allocator, for a blob an ImGui
struct takes ownership of and frees itself with IM_FREE: a font's TTF
data with fontDataOwnedByAtlas (released when the atlas source goes
away, so with the context), glyphExcludeRanges... Handing ImGui a
buffer from any other allocator crashes at that free - and keeping the
buffer out of ImGui's hands instead means leaking it once per context,
which an editor that reloads the app in-process (Unity's play mode)
turns into a leak per run.
Allocate raw native bytes (for payloads, point buffers...). The address
type follows the target's convention (cpp pointer, js Int, cs Float);
use the Bytes* helpers below to read/write portably.
64-bit integers cross as Haxe Float (53-bit precision, fine for UI demo values).
Private Members
Copy a haxe.io.Bytes into already allocated native memory.