Crate bevy_ascii_terminal

Source
Expand description

License: MIT Crates.io docs

§Bevy Ascii Terminal

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.

§Example

use bevy::prelude::*;
use bevy_ascii_terminal::*;

fn setup(mut commands: Commands) {
    // Create the terminal
    let mut terminal = Terminal::new([20,3]).with_border(Border::single_line());
    // Draw a blue "Hello world!" to the terminal
    terminal.put_string([1, 1], "Hello world!".fg(Color::BLUE));

     
    commands.spawn((
        // Spawn the terminal bundle from our terminal
        TerminalBundle::from(terminal),
        // Automatically set up the camera to render the terminal
        AutoCamera
    ));
}

fn main () {
    App::new()
    .add_plugins((DefaultPlugins, TerminalPlugin))
    .add_systems(Startup, setup)
    .run();
}

§Versions

bevybevy_ascii_terminal
0.130.15.0
0.120.14.0
0.110.13.0
0.90.12.1
0.8.10.11.1-4
0.80.11
0.70.9-0.10

Re-exports§

pub use prelude::*;

Modules§

code_page_437
Utilities for translating between glyphs and Code Page 437 indices.
prelude

Structs§

AutoCamera
This component can be added to terminal entities as a simple way to have have the camera render the terminals. The camera viewport will automatically be resized to show all terminal entities with this component.
TerminalChangeFont
The primary terminal rendering function labels System set for the terminal font changing function.
TerminalInit
The primary terminal rendering function labels System set for the terminal mesh initialization system.
TerminalLayout
Layout settings for the terminal renderer.
TerminalLayoutChange
The primary terminal rendering function labels System set for the terminal mesh size update function.
TerminalLayoutUpdate
The primary terminal rendering function labels System set for the terminal layout update system.
TerminalMaterial
TerminalMaterialChange
The primary terminal rendering function labels System set for the terminal material change system.
TerminalPlugin
Plugin for terminal rendering and related components and systems.
TerminalRender
The primary terminal rendering function labels System set for the terminal render system. This is the last terminal system to run and runs at the end of the frame.
TerminalUpdateTiles
The primary terminal rendering function labels
TiledCamera
A camera with a virtual grid for displaying low resolution pixel art.
TiledCameraBundle
Component bundle with functions to specify how you want the camera set up.
ToWorld
A component for converting positions between World Space and “Terminal Space”.

Enums§

Pivot
A pivot point on a 2d rect.
Side
TerminalFont
Helper component for changing the terminal’s font

Traits§

GridPoint
A trait for types representing an integer point on a 2d grid.
Size2d
A trait for types representing a 2d size.