Crates.io | bevy_crossterm |
lib.rs | bevy_crossterm |
version | 0.4.0 |
source | src |
created_at | 2020-12-28 01:50:08.38821 |
updated_at | 2020-12-28 01:50:08.38821 |
description | Develop terminal games with crossterm and Bevy |
homepage | |
repository | https://github.com/octotep/bevy_crossterm/ |
max_upload_size | |
id | 328085 |
size | 2,575,851 |
bevy_crossterm
is a Bevy plugin that uses crossterm as a renderer. It provides custom components and events which allow users to develop games for the terminal.
Sprites and styles with colors and attributes
Incremental drawing: Only draw on the screen when something has changed
Transparency: Sprites can have holes so any sprites underneath will not be covered
Position, show, and hide the cursor
Set window title
Plugs into Bevy's asset system so sprites and styles can be loaded from disk and also hot reloaded
See the examples for runnable code and detailed comments.
[dependencies]
bevy = { version = "0.4", default-features = false }
bevy_crossterm = { git = "https://github.com/octotep/bevy_crossterm", branch = "trunk" }
use bevy::prelude::*;
use bevy_crossterm::prelude::*;
pub fn main() {
let mut settings = WindowSettings::default();
settings.set_title("Hello, World!");
App::build()
// Add our window settings
.add_resource(settings)
// Add the DefaultPlugins before the CrosstermPlugin. The crossterm plugin needs bevy's asset server, and if it's
// not available you'll trigger an assert
.add_plugins(DefaultPlugins)
.add_plugin(CrosstermPlugin)
.add_startup_system(startup_system.system())
.run();
}
fn startup_system(
commands: &mut Commands,
mut sprites: ResMut<Assets<Sprite>>,
mut stylemaps: ResMut<Assets<StyleMap>>,
) {
commands
.spawn(SpriteBundle {
sprite: sprites.add(Sprite::new("Hello, world!")),
stylemap: stylemaps.add(StyleMap::default()),
..Default::default()
});
}
Press Control-c to exit at any time.