ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches

Centralized render loop abstraction for all display modes. More...

Go to the source code of this file.

Typedefs

typedef bool(* session_should_exit_fn) (void *user_data)
 Exit condition callback type.
typedef image_t *(* session_capture_fn) (void *user_data)
 Capture callback for event-driven frame source.
typedef void(* session_sleep_for_frame_fn) (void *user_data)
 Sleep callback for custom frame timing.
typedef void(* session_keyboard_handler_fn) (session_capture_ctx_t *capture, int key, void *user_data)
 Keyboard input handler callback type.

Functions

asciichat_error_t session_render_loop (session_capture_ctx_t *capture, session_display_ctx_t *display, session_should_exit_fn should_exit, session_capture_fn capture_cb, session_sleep_for_frame_fn sleep_cb, session_keyboard_handler_fn keyboard_handler, void *user_data)
 Unified render loop for all display modes.

Detailed Description

Centralized render loop abstraction for all display modes.

Provides a single, unified render loop that handles:

  • Frame rate limiting (adaptive sleep)
  • Frame capture from media source or custom callbacks
  • ASCII art conversion with palette and terminal capabilities
  • Terminal rendering with snapshot mode support
  • Memory cleanup

All display modes (mirror, client, discovery) use this single loop. Modes can either:

  • Pass capture context (NULL callbacks) for synchronous operation
  • Pass custom callbacks (NULL capture) for event-driven operation
Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026

Definition in file src/common/session/render.h.