.. _stdlib_imgui_live: ==================================================== Live-reload lifecycle and synthetic-IO bypass driver ==================================================== .. das:module:: imgui_live Live-reload lifecycle plus the synthetic-IO bypass driver. The ``imgui_live`` half wires up GLFW window creation, ImGui context construction, and the ``daslang-live`` integration so a script can hot-reload its widget code without losing window state. The ``imgui_live_core`` half carries the synth-IO transport — mouse + keyboard timelines, ``imgui_mouse_play`` / ``imgui_key_play`` event drains, side-mod alias emission, position-prefix button ordering — so headless test recordings and playwright drivers generate input that ImGui sees as if it came from the OS. The synth path replaces the GLFW backend's ``UpdateMouseData`` polling once per frame via :ref:`apply_synth_io_override `, reasserting the synth cursor pose between ``Impl_NewFrame`` and ``NewFrame``. Visible widgets that "don't fire" trace to this override race; the bypass driver always wins. ++++++++++ Structures ++++++++++ .. _struct-imgui_live_core-MouseMoveToArgs: .. das:attribute:: MouseMoveToArgs struct MouseMoveToArgs .. _struct-imgui_live_core-MouseClickAtArgs: .. das:attribute:: MouseClickAtArgs struct MouseClickAtArgs .. _struct-imgui_live_core-MouseEventWire: .. das:attribute:: MouseEventWire struct MouseEventWire .. _struct-imgui_live_core-MousePlayArgs: .. das:attribute:: MousePlayArgs struct MousePlayArgs .. _struct-imgui_live_core-MouseStatusResult: .. das:attribute:: MouseStatusResult struct MouseStatusResult .. _struct-imgui_live_core-KeyTypeArgs: .. das:attribute:: KeyTypeArgs struct KeyTypeArgs .. _struct-imgui_live_core-KeyChordArgs: .. das:attribute:: KeyChordArgs struct KeyChordArgs .. _struct-imgui_live_core-KeyEventWire: .. das:attribute:: KeyEventWire struct KeyEventWire .. _struct-imgui_live_core-KeyPlayArgs: .. das:attribute:: KeyPlayArgs struct KeyPlayArgs .. _struct-imgui_live_core-KeyStatusResult: .. das:attribute:: KeyStatusResult :Fields: * **playing** : bool - true while a recorded key timeline is being replayed. * **elapsed_ms** : int - milliseconds since timeline playback began (0 when idle). * **queue_idx** : int - index of the next pending event in the timeline. * **queue_total** : int - total number of events in the active timeline. * **held_count** : int - number of synthetic keys currently held down. * **last_keycode** : int - ImGuiKey value (renamed from "key" so visual_aids can read uniformly) * **last_codepoint** : uint - most recent codepoint pushed via AddInputCharacter. +++++++++ Lifecycle +++++++++ * :ref:`live_imgui_init (window: GLFWwindow?) : ImGuiContext? ` * :ref:`live_imgui_render () ` * :ref:`live_imgui_shutdown () ` .. _function-imgui_live_live_imgui_init_GLFWwindow_q_: .. das:function:: live_imgui_init(window: GLFWwindow?) : ImGuiContext? Idempotent ImGui context create + backend init; reload-safe (reuses preserved ctx). Content scale: ``--imgui-content-scale`` override else ``glfwGetWindowContentScale``; bakes JetBrains Mono at ``14*scale`` px. Auto path divides out the GL fb/window ratio so retina isn't double-scaled (no-op on Windows DPI / override). Call from ``init()``. :Arguments: * **window** : :ref:`GLFWwindow `? .. _function-imgui_live_live_imgui_render: .. das:function:: live_imgui_render() Drain the dynamic-texture queue and replay this frame's ImDrawData with the pure-das GL renderer (opengl_imgui_driver). Call after ``Render()``, in place of the old C++ backend's draw step. .. _function-imgui_live_live_imgui_shutdown: .. das:function:: live_imgui_shutdown() Reload-aware ImGui shutdown — skips during reload so the ctx is reused, runs only on process exit. Call from your script's ``shutdown()``. ++++++++++++++++ Synth IO drivers ++++++++++++++++ * :ref:`imgui_key_chord (input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_play (input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_status (_input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_stop (_input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_type (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_click_at (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_move_to (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_play (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_status (_input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_stop (_input: JsonValue?) : JsonValue? ` .. _function-imgui_live_core_imgui_key_chord_JsonValue_q_: .. das:function:: imgui_key_chord(input: JsonValue?) : JsonValue? def imgui_key_chord (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_key_play_JsonValue_q_: .. das:function:: imgui_key_play(input: JsonValue?) : JsonValue? def imgui_key_play (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_key_status_JsonValue_q_: .. das:function:: imgui_key_status(_input: JsonValue?) : JsonValue? def imgui_key_status (_input: JsonValue?) : JsonValue? :Arguments: * **_input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_key_stop_JsonValue_q_: .. das:function:: imgui_key_stop(_input: JsonValue?) : JsonValue? def imgui_key_stop (_input: JsonValue?) : JsonValue? :Arguments: * **_input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_key_type_JsonValue_q_: .. das:function:: imgui_key_type(input: JsonValue?) : JsonValue? def imgui_key_type (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_mouse_click_at_JsonValue_q_: .. das:function:: imgui_mouse_click_at(input: JsonValue?) : JsonValue? def imgui_mouse_click_at (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_mouse_move_to_JsonValue_q_: .. das:function:: imgui_mouse_move_to(input: JsonValue?) : JsonValue? def imgui_mouse_move_to (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_mouse_play_JsonValue_q_: .. das:function:: imgui_mouse_play(input: JsonValue?) : JsonValue? def imgui_mouse_play (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_mouse_status_JsonValue_q_: .. das:function:: imgui_mouse_status(_input: JsonValue?) : JsonValue? def imgui_mouse_status (_input: JsonValue?) : JsonValue? :Arguments: * **_input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_mouse_stop_JsonValue_q_: .. das:function:: imgui_mouse_stop(_input: JsonValue?) : JsonValue? def imgui_mouse_stop (_input: JsonValue?) : JsonValue? :Arguments: * **_input** : :ref:`JsonValue `? +++++++++++++++ Event timelines +++++++++++++++ * :ref:`sort_key_play_events (var events: array\) ` * :ref:`sort_mouse_play_events (var events: array\) ` .. _function-imgui_live_core_sort_key_play_events_array_ls_KeyEventWire_gr_: .. das:function:: sort_key_play_events(events: array) Sort wire-format key events ascending by ``t_ms`` in place — call before feeding ``imgui_key_play`` so the timeline drains in chronological order. :Arguments: * **events** : array< :ref:`KeyEventWire `> .. _function-imgui_live_core_sort_mouse_play_events_array_ls_MouseEventWire_gr_: .. das:function:: sort_mouse_play_events(events: array) Sort wire-format mouse events ascending by ``t_ms`` in place — call before feeding ``imgui_mouse_play`` so the timeline drains in chronological order. :Arguments: * **events** : array< :ref:`MouseEventWire `> ++++++++++++++++++++++ Status / introspection ++++++++++++++++++++++