ImGuiSystem
Dear ImGui integration for ceramic - fully backend-agnostic.
Everything goes through ceramic itself, so the SAME code runs on clay (native + web) and unity:
- INPUT: ceramic events are forwarded to ImGui's 1.87+ event queue
(
addMousePosEvent,addKeyEvent, ...), text goes through ceramic's text input sessions (IME-aware), driven byio.wantTextInput. - FRAME:
newFrame()at early update (before user code builds its UI inupdate()),render()at late update. - RENDERING:
ImGuiRenderableconsumes the draw data through the concretebackend.Drawduring the normal visuals pass (no imgui_impl_* backend). - TEXTURES: the 1.92
ImTextureDataprotocol handled with ceramic textures;ImTextureIDis a registry key (seeImGuiTextures). - LAYOUT: window positions, sizes and dock nodes are persisted through
ceramic's
PersistentDatainstead of ImGui's ownimgui.inifile (seesaveLayout()); opt out with theimgui_no_persistent_layoutdefine.
Usage stays the same as before: make ImGui.* calls anywhere between
updates (typically in update()); frame boundaries are automatic.
Static Members
Name of the default font bundled with the plugin (Roboto-Medium), used
when the project does not provide its own imgui_font define.
Name of the default fallback font bundled with the plugin (Kosugi, for CJK glyph coverage), merged into the default font.
Shared ImGui system instance. Automatically created when first accessed.
Id of the PersistentData storage holding the ImGui layout (window
positions and sizes, dock node tree, collapsed/selected tabs...).
Instance Members
True when ImGui wants the mouse (apps should ignore clicks then).
True when ImGui wants the keyboard.
The renderable that draws ImGui (its depth places the UI, default topmost).
The custom font loaded from the imgui_font define (if any).
It is also assigned to io.fontDefault; use it with
ImGui.pushFontFloat(customFont, size) for per-window sizes.
Multiplier applied to ceramic wheel deltas before feeding ImGui. The default (1/24) is calibrated for a comfortable trackpad feel with ceramic's wheel units; raise it if a notched mouse wheel feels too slow.
When enabled (default), the ImGui UI is laid out at the screen's
NATIVE size (1 ImGui point = 1 screen point), independently of the
app's logical scaling (FIT, FILL...): the game keeps its own scaling
while the UI stays at a consistent, crisp size. This is the same
behavior as the elements plugin's Im UI. Set to false to lay out the UI in
the app's logical coordinates instead (the previous behavior, where
the UI is scaled together with the app content).
Write the current ImGui layout to persistent storage now.
Called automatically when ImGui reports the layout changed and when the app terminates; call it explicitly to save at another moment (before a scene switch, on window blur...). No-op when layout persistence is off.
Forget the persisted layout, so the next run starts from the app's
default arrangement again (see imgui.ImGuiDockBuilder to build one).
This does not rearrange the live windows: pair it with a rebuild of the layout, or with a restart.
Convert a position in ceramic's logical screen coordinates to ImGui
coordinates (native screen points when nativeScreen is enabled,
identical coordinates otherwise).
| Name | Type |
|---|---|
x |
Float |
y |
Float |
| Returns |
|---|
| Float |
| Name | Type |
|---|---|
x |
Float |
y |
Float |
| Returns |
|---|
| Float |
Convert a position in ImGui coordinates back to ceramic's logical screen coordinates.
| Name | Type |
|---|---|
x |
Float |
y |
Float |
| Returns |
|---|
| Float |
| Name | Type |
|---|---|
x |
Float |
y |
Float |
| Returns |
|---|
| Float |
Private Members
Key of the ini settings blob inside that storage.
| Name | Type |
|---|---|
buttonId |
Int |
| Returns |
|---|
| Int |
| Name | Type |
|---|---|
done |
Function |
Load fontId as the default ImGui font and, if fallbackId is provided,
merge its glyphs (e.g. CJK) into it. Both are binary asset names.
| Name | Type | Default |
|---|---|---|
fontId |
String | |
fallbackId |
String | (optional) |
Take over ImGui's ini settings and store them through ceramic.
Left alone, ImGui reads and writes imgui.ini in the process working
directory: inside the bundle for a packaged mac app (where a stale file
silently overrides every FirstUseEver position), and nowhere at all on
web. PersistentData goes through app.backend.io, so the layout lands
where the backend puts save data on every target, web included.
| Name | Type |
|---|---|
delta |
Float |
| Name | Type |
|---|---|
delta |
Float |
| Name | Type |
|---|---|
key |
Key |
down |
Bool |
Characters flow through ceramic's text input sessions (IME-aware): we open a session while ImGui wants text, and forward what gets typed by diffing the session buffer (editing keys are handled by ImGui itself through the key events).
| Name | Type |
|---|---|
want |
Bool |
| Name | Type |
|---|---|
text |
String |
Metadata
| Name | Parameters |
|---|---|
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |