Skip to content

Conversation

@junkdog
Copy link
Member

@junkdog junkdog commented Jun 28, 2025

This merge request implements the multi-backend functionality discussed in #103. It adds the ability to switch between different rendering backends (DOM, Canvas, WebGL2) on the fly (reloads the application), along with a real-time FPS counter.

Changes

New Shared Library (examples/shared/)

  • Backend switching: Query parameter support (?backend=webgl2)
  • FPS tracking: Real-time performance monitoring
  • Visual footer: Backend switcher with current backend and FPS display
  • Unified API: backend_from_query_param() for consistent backend creation

Updated Examples

Modified all 17 examples to use the new multi-backend system:

// Before
let backend = DomBackend::new()?;
let terminal = Terminal::new(backend)?;

// After  
let (_backend_type, terminal) = backend_from_query_param(BackendType::Dom)
    .webgl2_options(WebGl2BackendOptions::new().measure_performance(true)) // per-backend options
    .build_terminal()?;

Features

image

  • Real-time FPS: Automatic tracking and display
  • Visual switcher: Fixed footer with clickable backend links

@junkdog
Copy link
Member Author

junkdog commented Jun 29, 2025

if #108 is merged before this one, some examples should be updated with the new options for hyperlinks

Copy link
Member

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so neat! Thanks <3

It requires a refactor and we should be set

@junkdog
Copy link
Member Author

junkdog commented Jul 20, 2025

there, i think everything above has been addressed

@orhun orhun changed the title add multi-backend support for examples feat(examples): add multi-backend support Jul 21, 2025
Copy link
Member

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, LGTM!

@orhun orhun merged commit 248e6a7 into ratatui:main Jul 21, 2025
7 checks passed
@junkdog junkdog deleted the multi-backend-from-query-param branch December 25, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants