package miaou-driver-matrix

  1. Overview
  2. Docs
Miaou high-performance terminal driver with diff rendering

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.5.2.tar.gz
md5=60a3b9f181f24572a06a9492532bfdda
sha512=fcc35a275066be2900e6201782faf47503076fa4640f08cf78067835a6f447b74613009e55b2ac799adb7ca46f1bffa261fc5971753f2cc3c6bef327511c7ef6

doc/miaou-driver-matrix.driver/Miaou_driver_matrix/Matrix_render_loop/index.html

Module Miaou_driver_matrix.Matrix_render_loopSource

Render loop for the Matrix driver.

Manages frame rendering in a dedicated OCaml 5 Domain for true parallelism. The render domain runs at configurable FPS, computing diffs between front/back buffers and emitting minimal ANSI sequences.

Architecture:

  • Main domain: Input handling, state updates, writes to back buffer
  • Render domain: Reads buffers, computes diff, writes via output sink

The buffer uses mutex synchronization for thread safety.

Sourcetype t

Render loop state.

Sourceval create : config:Matrix_config.t -> buffer:Matrix_buffer.t -> writer:Matrix_ansi_writer.t -> write:(string -> unit) -> t

Create a new render loop (does not start the domain yet).

  • parameter config

    Configuration (FPS cap, debug mode)

  • parameter buffer

    Double buffer for diff computation

  • parameter writer

    ANSI writer for output generation

  • parameter write

    Output sink: sends ANSI string to terminal or WebSocket

Sourceval start : t -> unit

Start the render domain. Call once after setup.

Sourceval request_frame : t -> unit

Request a frame to be rendered (legacy API, now no-op). The render domain automatically renders when buffer is dirty.

Sourceval render_if_needed : t -> bool

Render immediately if buffer is dirty. For use before domain starts or after shutdown. Returns true if a frame was rendered.

Sourceval force_render : t -> unit

Force immediate render regardless of dirty state.

Sourceval shutdown : t -> unit

Shutdown the render loop and join the domain.

Sourceval current_fps : t -> float

Get current achieved FPS - actual renders per second (for diagnostics). Thread-safe.

Sourceval loop_fps : t -> float

Get loop FPS - how fast the render loop is checking (the cap). Thread-safe.

Sourceval frame_pending : t -> bool

Check if buffer needs render.

Sourceval is_running : t -> bool

Check if render domain is running.