Git Product home page Git Product logo

bevy_crossterm's Introduction

bevy_crossterm

What is bevy_crossterm?

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.

Table of Contents

Features

  • Sprites and styles with colors and attributes
    • Up to 24-bit color (depends on what the host terminal supports)
  • 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

Demo GIF

demo

Getting Started

See the examples for runnable code and detailed comments.

[dependencies]
bevy = { version = "0.4", default-features = false }
bevy_crossterm = "0.4.0"
use bevy::prelude::*;
use bevy_crossterm::prelude::*;

pub fn main() {
    let mut settings = CrosstermWindowSettings::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.

bevy_crossterm's People

Contributors

octotep avatar cowboy8625 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.