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.


imgui
numEntries: Int

Number of active entries (displayed this frame or in grace period).


imgui
numDedicated: Int

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

imgui
visualButton(id: String, visual: Visual, ?width: Float = -1, ?height: Float = -1, ?interactive: Bool = false, ?antialiasing: Int = 0, ?textureFilter: Anonymous, ?nativeResolution: Bool = false): Bool

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
Returns
Bool

imgui
texture(texture: Texture, ?width: Float = -1, ?height: Float = -1): Void

Display any ceramic texture (thin wrapper over ImGui.image + textureRef).

Name Type Default
texture Texture
width Float -1
height Float -1

imgui
tile(tile: TextureTile, ?width: Float = -1, ?height: Float = -1): Void

Display a ceramic TextureTile (sub-region of a texture), UVs computed.

Name Type Default
tile TextureTile
width Float -1
height Float -1

imgui
isWindowFocused(visual: Visual): Bool

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.

Name Type
visual Visual
Returns
Bool

imgui
isHovered(visual: Visual): Bool

Whether the displayed image of visual is currently hovered (as reported by ImGui, so ImGui window occlusion is respected).

Name Type
visual Visual
Returns
Bool

Private Members

imgui
entries: Map

imgui
currentFrame: Int

imgui
sharedPackers: Map

imgui
PAD_WIDTH: Int

imgui
PAD_HEIGHT: Int

imgui
MARGIN: Int

imgui
touch(visual: Visual, width: Float, height: Float, antialiasing: Int, textureFilter: Anonymous, nativeResolution: Bool): ceramic._ImGuiVisuals.ImGuiVisualEntry

Get or create the entry for visual, mark it used this frame, sync sizes/settings.

Name Type
visual Visual
width Float
height Float
antialiasing Int
textureFilter Anonymous
nativeResolution Bool
Returns
ceramic._ImGuiVisuals.ImGuiVisualEntry

imgui
submitImage(entry: ceramic._ImGuiVisuals.ImGuiVisualEntry, interactive: Bool, buttonId: String): Bool

Submit the ImGui image (or image button) + align the filter for hits.

Name Type
entry ceramic._ImGuiVisuals.ImGuiVisualEntry
interactive Bool
buttonId String
Returns
Bool

imgui
packer(antialiasing: Int, nearest: Bool): TextureTilePacker

Shared atlas packer for the given settings (lazy, one per combination).

Name Type
antialiasing Int
nearest Bool
Returns
TextureTilePacker

imgui
maxTileSize(isWidth: Bool): Int

Max tile size a shared packer page can hold (same math as allocTile).

Name Type
isWidth Bool
Returns
Int

imgui
endFrame(): Void

Called by ImGuiSystem after ImGui.render(): sweep unused entries.


imgui
markDedicated(add: Bool): Void
Name Type
add Bool

Metadata

Name Parameters
:hxGen -