Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions daslib/json_boost.das
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,11 @@ def from_JV(v : JsonValue const explicit?; anything : auto(TT)) {
unsafe {
let arr & = v.value as _array
ret |> reserve(arr |> length)
for (i in range(arr |> length)) {
for (a in arr) {
if (typeinfo can_copy(anything[0])) {
ret |> push_clone <| _::from_JV(arr[i], decltype_noref(anything[0]))
ret |> push_clone <| _::from_JV(a, decltype_noref(anything[0]))
} else {
ret |> emplace <| _::from_JV(arr[i], decltype_noref(anything[0]))
ret |> emplace <| _::from_JV(a, decltype_noref(anything[0]))
}
}
return <- ret
Expand Down
5 changes: 3 additions & 2 deletions doc/reflections/das2rst.das
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,8 @@ def document_module_stbimage(root : string) {
group_by_regex("File writing", mod, %regex~(stbi_write_png|stbi_write_bmp|stbi_write_tga|stbi_write_jpg|stbi_write_hdr)$%%),
group_by_regex("Write to memory", mod, %regex~(stbi_write_png_to_memory|stbi_write_bmp_to_memory|stbi_write_tga_to_memory|stbi_write_jpg_to_memory)$%%),
group_by_regex("Write settings", mod, %regex~(stbi_flip_vertically_on_write|stbi_write_set_.*|stbi_write_get_.*)$%%),
group_by_regex("Image resizing", mod, %regex~(stbir_resize|stbir_resize_uint8_srgb|stbir_resize_uint8_linear|stbir_resize_float_linear)$%%)
group_by_regex("Image resizing", mod, %regex~(stbir_resize|stbir_resize_uint8_srgb|stbir_resize_uint8_linear|stbir_resize_float_linear)$%%),
group_by_regex("Animated PNG (APNG) writer", mod, %regex~stbi_apng_(begin|frame|end|dropped)$%%)
)
document("Image loading, writing, and resizing (stb_image)", mod, "stbimage.rst", groups)
}
Expand Down Expand Up @@ -1437,7 +1438,7 @@ def document_module_strudel_scheduler(root : string) {
var mod = find_module("strudel_scheduler")
var groups <- array<DocGroup>(
group_by_regex("Orbit effects", mod, %regex~(init_reverb|init_delay|get_orbit_reverb|get_orbit_delay|get_orbit_chorus)$%%),
group_by_regex("Scheduler lifecycle", mod, %regex~(tick|shutdown_scheduler)$%%)
group_by_regex("Scheduler lifecycle", mod, %regex~(tick|shutdown_scheduler|finalize)$%%)
)
document("Voice allocation, effect bus routing, and per-tick mixing", mod, "strudel_scheduler.rst", groups)
}
Expand Down
47 changes: 45 additions & 2 deletions doc/source/reference/utils/daslang_live.rst
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ Helper modules
* - Module
- Description
* - ``live/glfw_live``
- GLFW window that persists across reloads.
- GLFW window that persists across reloads + synthetic mouse driver.
* - ``live/opengl_live``
- OpenGL screenshot command.
- OpenGL screenshot + APNG video recording commands.
* - ``live/decs_live``
- Auto-serialization of DECS entities across reloads.
* - ``live/live_commands``
Expand Down Expand Up @@ -387,6 +387,49 @@ survives reloads. Key functions:
* - ``live_get_framebuffer_size(w, h)``
- Query framebuffer dimensions.

Synthetic mouse driver
^^^^^^^^^^^^^^^^^^^^^^

``live/glfw_live`` also provides a synthetic-input timeline driver. Events
flow through ``dasGLFW``'s chain dispatcher, so any listener installed on
the window (``ImGui_ImplGlfw``, app callbacks, etc.) receives them
indistinguishably from real OS input. Used by the visual-aids demo to
re-record APNG tours from a JSON timeline.

.. list-table::
:header-rows: 1
:widths: 30 70

* - Command
- Description
* - ``mouse_pos``
- Teleport synthetic cursor. Args: ``x``, ``y``.
* - ``mouse_click``
- Synthetic button press/release. Args: ``button`` (0/1/2),
``action`` (``"press"`` | ``"release"``).
* - ``mouse_scroll``
- Synthetic scroll. Args: ``x``, ``y`` (offsets).
* - ``mouse_move_to``
- Animated linear move to ``(x, y)`` over ``duration_ms``
(default 250). Per-frame lerp posts one cursor event per frame.
* - ``mouse_play``
- Play a scripted timeline. Args: ``events`` array of
``{t_ms, kind, x, y, button, action}`` where ``kind`` is
``"move"`` | ``"button"`` | ``"scroll"``. Between move events the
per-frame tick lerps and posts one cursor event per frame so any
reader (ImGui, overlays) sees smooth motion.
* - ``mouse_stop``
- Stop playback and clear the queue.
* - ``mouse_status``
- Playback status: ``playing``, ``elapsed_ms``, ``cursor_x``,
``cursor_y``, ``queue_idx``, ``queue_total``.

``get_synth_cursor() : tuple<bool; float; float>`` returns
``(active, x, y)``. Overlays that draw a cursor sprite or motion trail
should consult this — when ``active`` the synthetic driver owns the
position, and ``ImGui_ImplGlfw``'s per-frame poll would otherwise
overwrite ``io.MousePos`` with the real OS cursor on focused windows.

``live/decs_live``
------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Begin streaming APNG encoding to ``filename``. ``channels`` is 3 (RGB) or 4 (RGBA). Returns an opaque writer handle; pass it to ``stbi_apng_frame`` and ``stbi_apng_end``, or ``null`` on failure.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return the running count of frames dropped because the encoder thread's bounded queue was full.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Finalize the APNG file: drain the encoder thread, backpatch the ``acTL`` frame count, write ``IEND``, and free the writer. Returns 1 on success.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Queue one frame on ``writer``. Pixels are expected in bottom-up row order (``glReadPixels`` output) — the encoder thread flips rows top-down before encoding, so callers should not pre-flip. ``stride_bytes`` is the positive pixel-row stride and must be at least ``width * channels``; negative-stride values are rejected. ``delay_ms`` is how long the frame is shown. Returns 1 on success (including the queue-full case, which silently drops the oldest queued frame — see ``stbi_apng_dropped`` for the running count), 0 on invalid input (null pixels / bad stride) **or** if the writer has entered an internal error state from a prior async I/O or encode failure; in that case callers should stop and call ``stbi_apng_end``.
Loading
Loading