ImGuiVisuals
ceramic.ImGuiVisuals (Class)
Display ceramic visuals inside Dear ImGui layouts.
Call ImGuiVisuals.visual(myVisual) anywhere between ImGui widgets: the
visual is rendered offscreen (through a Filter) and displayed with
ImGui.image(). Immediate-mode friendly: call it every frame, entries are
created/reused/released automatically.
- The visual is REPARENTED into the filter content while displayed (same
semantics as elements' Im.visual()): it leaves its previous parent, and
is deactivated (never destroyed) when no longer displayed.
- Small/medium visuals share a single render texture atlas
(
TextureTilePacker, pages chained automatically); visuals larger than
a page get their own render texture.
- Pointer events work: the filter is invisibly aligned with the ImGui
image rect, so
onPointerDown/Up/Over/... on the content visuals behave
normally (gated by ImGui hover, so ImGui window occlusion is respected).
- Cross-target: pure ceramic + portable ImGui facade.
Static Members
imgui
gracePeriodFrames: Int
Frames an entry is kept alive after its visual stops being displayed.
Number of active entries (displayed this frame or in grace period).
Number of entries currently using a dedicated render texture (not the shared atlas).
imgui
visual(visual: Visual, ?width: Float = -1, ?height: Float = -1, ?interactive: Bool = true, ?antialiasing: Int = 0, ?textureFilter: Anonymous, ?nativeResolution: Bool = false): Void
Display visual inside the current ImGui layout.
Without explicit size, uses the visual's own width/height. With a
size, the visual is scaled to fit (uniform) and centered.
With interactive (default), ceramic pointer events are redirected to
the content when the image is hovered.
antialiasing (MSAA samples) and textureFilter (LINEAR default,
NEAREST for pixel-art) select the offscreen texture settings: visuals
sharing the same settings share the same atlas.
With nativeResolution, the visual is rendered offscreen at its OWN
size and the image is scaled to the display size (use it with NEAREST
for pixel-art, or to display a game at its native resolution); by
default the visual is rendered directly at display resolution.
| Name |
Type |
Default |
visual |
Visual |
|
width |
Float |
-1 |
height |
Float |
-1 |
interactive |
Bool |
true |
antialiasing |
Int |
0 |
textureFilter |
Anonymous |
(optional) |
nativeResolution |
Bool |
false |
Like visual(), but displayed as an ImGui button. Returns true when clicked.
| Name |
Type |
Default |
id |
String |
|
visual |
Visual |
|
width |
Float |
-1 |
height |
Float |
-1 |
interactive |
Bool |
false |
antialiasing |
Int |
0 |
textureFilter |
Anonymous |
(optional) |
nativeResolution |
Bool |
false |
imgui
texture(texture: Texture, ?width: Float = -1, ?height: Float = -1): Void
Display any ceramic texture (thin wrapper over ImGui.image + textureRef).
Display a ceramic TextureTile (sub-region of a texture), UVs computed.
Whether the ImGui window that displayed visual (last submit) is
focused (root or child windows). Useful to route keyboard input to a
game/scene displayed inside an ImGui window:
read app.input only when its window is focused.
Whether the displayed image of visual is currently hovered
(as reported by ImGui, so ImGui window occlusion is respected).
Private Members
Get or create the entry for visual, mark it used this frame, sync sizes/settings.
Submit the ImGui image (or image button) + align the filter for hits.
Shared atlas packer for the given settings (lazy, one per combination).
| Name |
Type |
antialiasing |
Int |
nearest |
Bool |
imgui
maxTileSize(isWidth: Bool): Int
Max tile size a shared packer page can hold (same math as allocTile).
Called by ImGuiSystem after ImGui.render(): sweep unused entries.