#immediate-mode #game-engine #drawing #canvas #2d #api #plugin

bevy_canvas

An immediate mode 2D drawing API for Bevy game engine

1 unstable release

0.1.0 May 1, 2021

#36 in #immediate-mode

MIT license

130KB
710 lines

Bevy Canvas API

An immediate mode 2D drawing API for Bevy game engine.

Known issues

  • MSAA not working
  • WebGL support absent

lib.rs:

Unofficial Bevy canvas API

This crate allows Bevy users to arbitrarily draw 2D shapes without spawning any entity. You will need to spawn a 2D camera.

The main goal of this project is to help users draw any geometric shape in the most ergonomical possible way, without the need to spawn entities, unlike bevy_prototype_lyon.

Setup

Don't forget to add the plugin and a 2d camera. Here's an example:

use bevy::prelude::*;
use bevy_canvas::CanvasPlugin;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_plugin(bevy_canvas::CanvasPlugin)
        .add_startup_system(setup.system());
}

fn setup(mut commands: Commands) {
    commands.spawn_bundle(OrthographicCameraBundle::new_2d());
}

Usage

For the common usage guide, see the plugin documentation.

Dependencies

~25–67MB
~685K SLoC