.. _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-MousePosArgs: .. das:attribute:: MousePosArgs struct MousePosArgs .. _struct-imgui_live_core-MouseClickArgs: .. das:attribute:: MouseClickArgs struct MouseClickArgs .. _struct-imgui_live_core-MouseScrollArgs: .. das:attribute:: MouseScrollArgs struct MouseScrollArgs .. _struct-imgui_live_core-MouseMoveToArgs: .. das:attribute:: MouseMoveToArgs struct MouseMoveToArgs .. _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-KeyPressArgs: .. das:attribute:: KeyPressArgs struct KeyPressArgs .. _struct-imgui_live_core-KeyCharArgs: .. das:attribute:: KeyCharArgs struct KeyCharArgs .. _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?; glsl_version: string = "#version 330") : ImGuiContext? ` * :ref:`live_imgui_shutdown () ` .. _function-imgui_live_live_imgui_init_GLFWwindow_q__string: .. das:function:: live_imgui_init(window: GLFWwindow?; glsl_version: string = "#version 330") : ImGuiContext? Idempotent ImGui context create + backend init; safe across reload (reuses preserved ctx). Reads the window's content scale, loads JetBrains Mono at ``14 * scale`` px, applies the daslang theme, and calls ``ScaleAllSizes(scale)`` so paddings/ spacings/rounding match the display. Call from your script's ``init()``. :Arguments: * **window** : :ref:`GLFWwindow `? * **glsl_version** : string .. _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_char (input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_chord (input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_play (input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_press (input: JsonValue?) : JsonValue? ` * :ref:`imgui_key_release (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 (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_move_to (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_play (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_pos (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_scroll (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_status (input: JsonValue?) : JsonValue? ` * :ref:`imgui_mouse_stop (input: JsonValue?) : JsonValue? ` * :ref:`imgui_synth_tick () ` * :ref:`synth_tick_run_count () : int ` * :ref:`synth_warned_no_override () : bool ` .. _function-imgui_live_core_imgui_key_char_JsonValue_q_: .. das:function:: imgui_key_char(input: JsonValue?) : JsonValue? def imgui_key_char (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`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_press_JsonValue_q_: .. das:function:: imgui_key_press(input: JsonValue?) : JsonValue? def imgui_key_press (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_key_release_JsonValue_q_: .. das:function:: imgui_key_release(input: JsonValue?) : JsonValue? def imgui_key_release (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_JsonValue_q_: .. das:function:: imgui_mouse_click(input: JsonValue?) : JsonValue? def imgui_mouse_click (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_pos_JsonValue_q_: .. das:function:: imgui_mouse_pos(input: JsonValue?) : JsonValue? def imgui_mouse_pos (input: JsonValue?) : JsonValue? :Arguments: * **input** : :ref:`JsonValue `? .. _function-imgui_live_core_imgui_mouse_scroll_JsonValue_q_: .. das:function:: imgui_mouse_scroll(input: JsonValue?) : JsonValue? def imgui_mouse_scroll (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 `? .. _function-imgui_live_core_imgui_synth_tick: .. das:function:: imgui_synth_tick() Per-frame entry point — advance synth mouse/key timelines and re-assert held state. Call between the backend's ``*_NewFrame()`` and ``ImGui::NewFrame()``; no-op when no synth command has fired. .. _function-imgui_live_core_synth_tick_run_count: .. das:function:: synth_tick_run_count() : int Number of times :ref:`imgui_synth_tick ` has run this process. Zero means ``apply_synth_io_override()`` has never fired — any queued synth event will silently no-op. .. _function-imgui_live_core_synth_warned_no_override: .. das:function:: synth_warned_no_override() : bool True iff the no-override warning has been emitted this process. One-shot — only the first synth command on a process that hasn't ticked flips this. +++++++++++++++ Event timelines +++++++++++++++ * :ref:`sort_mouse_play_events (var events: array\) ` .. _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 ++++++++++++++++++++++ +++++++++++++ Uncategorized +++++++++++++ .. _function-imgui_live_core_get_synth_cursor: .. das:function:: get_synth_cursor() : tuple Current synth cursor as ``(owned, x, y)``; ``owned=true`` means visual_aids overlays should render against this position instead of ``GetMousePos()``. .. _function-imgui_live_core_get_synth_keys: .. das:function:: get_synth_keys() : tuple Current synth-key state as ``(active, last_codepoint, last_codepoint_t)``; visual_aids polls this each frame to detect newly-landed codepoints. .. _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_warn_if_synth_tick_missing_string: .. das:function:: warn_if_synth_tick_missing(cmd: string) Emit a one-shot ``LOG_WARNING`` if ``cmd`` queued synth events before :ref:`imgui_synth_tick ` has ever run. Called from every synth-event-queueing live_command to surface the boost_basics-style trap (tutorial author forgot ``apply_synth_io_override()`` in ``update()``). :Arguments: * **cmd** : string .. _function-imgui_live_core_reset_synth_warning_state: .. das:function:: reset_synth_warning_state() Reset the one-shot tick-counter and warned flag. Intended for tests that re-exercise the trap detector within a single process.