#bevy #ascii #terminal #roguelike #tilemap

bevy_ascii_terminal

A simple terminal for rendering ascii in bevy

20 releases (8 breaking)

Uses new Rust 2021

new 0.9.0 Jan 14, 2022
0.7.6 Dec 26, 2021
0.7.4 Nov 24, 2021

#131 in Game dev

Download history 13/week @ 2021-09-25 27/week @ 2021-10-02 12/week @ 2021-10-09 12/week @ 2021-10-16 12/week @ 2021-10-23 15/week @ 2021-11-06 14/week @ 2021-11-13 106/week @ 2021-11-20 23/week @ 2021-11-27 35/week @ 2021-12-04 7/week @ 2021-12-11 2/week @ 2021-12-18 23/week @ 2021-12-25 7/week @ 2022-01-01 39/week @ 2022-01-08

71 downloads per month
Used in 2 crates

MIT license

73KB
1.5K SLoC

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 crisp 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)
    .insert_resource(ClearColor(Color::BLACK))
    .add_startup_system(setup)
    .run();
}

You can check the examples and the documentation for more information.

Dependencies

~23MB
~484K SLoC

.a