Expand description
A simple ascii terminal integrated into bevy’s ecs framework.
The goal of this crate is to provide a simple, straightforward, and hopefully fast method for rendering colorful ascii in bevy. It was made with “traditional roguelikes” in mind, but should serve as a simple UI tool if needed.
Rendering
In order to render the terminal you must add the TerminalPlugin via your bevy App
.
You then need a camera to display it. Though not a direct dependency, this crate
uses TiledCamera to render it’s examples.
It’s recommended to use this or some other similar camera for rendering, as bevy’s default orthographic camera is not a good fit for how the terminal is displayed.
Example
use bevy::prelude::*;
use bevy_ascii_terminal::*;
use bevy_tiled_camera::*;
fn setup(mut commands: Commands) {
let size = [20, 3];
let mut term_bundle = TerminalBundle::new().with_size(size);
let terminal = &mut term_bundle.terminal;
terminal.draw_border_single();
terminal.put_string([1, 1], "Hello world!");
commands.spawn_bundle(term_bundle);
commands.spawn_bundle(TiledCameraBundle::new()
.with_tile_count(size));
}
fn main () {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(TerminalPlugin)
.add_plugin(TiledCameraPlugin)
.add_startup_system(setup.system())
.run();
}
Re-exports
pub use formatting::CharFormat;
pub use formatting::Pivot;
pub use formatting::StringFormat;
pub use renderer::code_page_437;
pub use renderer::material::BuiltInFontHandles;
pub use renderer::material::TerminalMaterial;
Modules
Utilities for formatting strings and chars written to the terminal.
Handles mesh construction and rendering for the terminal.
Structs
Border glyphs used in box drawing functions.
A simple terminal for writing text in a readable grid.
A bundle with all the required components for a terminal.
Plugin for terminal rendering and related components and systems.
A single tile of the terminal.