bevy_terminal_display

Crates.iobevy_terminal_display
lib.rsbevy_terminal_display
version0.4.3
sourcesrc
created_at2024-07-24 16:05:54.547541
updated_at2024-08-24 00:45:50.379513
descriptionA plugin for the Bevy game engine which enables rendering to a terminal using unicode braille characters.
homepage
repositoryhttps://github.com/exvacuum/bevy_terminal_display
max_upload_size
id1314125
size85,885
Silas Bartha (exvacuum)

documentation

README

bevy_terminal_display

Crates License Tag Build Docs

A (very experimental) plugin for the Bevy engine which allows for rendering to a terminal window.

WARNING: I highly recommend using the kitty terminal emulator with this, not only due to the gpu-accelerated rendering, but also the implementation of the kitty protocol which enables the advanced input detection.

Features Include:

  • TerminalDisplayBundle automatically sets up a correctly-formatted render texture
  • Post-process dithers colors to pure black and white, which are then printed as braille characters to the terminal
  • Responsiveness to terminal window resizing
  • TerminalInput resource which keeps track of pressed & released keys
  • Widget component for rendering ratatui TUI widgets
  • TerminalWidget trait for creating custom TUI widget components
  • Log redirection

Screenshots

Compatibility

Crate Version Bevy Version
0.3-0.4 0.14
0.2 0.13

Installation

crates.io

[dependencies]
bevy_terminal_display = "0.3"

Using git URL in Cargo.toml

[dependencies.bevy_terminal_display]
git = "https://github.com/exvacuum/bevy_terminal_display.git"

Example Usage

In main.rs:

use bevy::prelude::*;
use bevy_terminal_display;

fn main() {
    App::new()
        .add_plugins((
            DefaultPlugins.build().disable::<WinitPlugin>().disable::<LogPlugin>,
            ScheduleRunnerPlugin::run_loop(Duration::from_secs_f32(1.0 / 60.0)),
            bevy_terminal_display::TerminalDisplayPlugin::default(),
        ))
        .insert_resource(Msaa::Off) // For post-process
        .run();
}

When spawning a camera:

let terminal_display_bundle = bevy_terminal_display::display::components::TerminalDisplayBundle::new(3, &asset_server);

commands.spawn((
    Camera3dBundle {
        camera: Camera {
            target: terminal_display_bundle.image_handle().into(),
            ..Default::default()
        },
        ..Default::default()
    },
    terminal_display_bundle,
));

License

This crate is licensed under your choice of 0BSD, Apache-2.0, or MIT license.

Commit count: 0

cargo fmt