GithubHelp home page GithubHelp logo

schneiderfelipe / bevy_prototype_lyon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nilirad/bevy_prototype_lyon

0.0 0.0 0.0 637 KB

Draw 2D shapes in Bevy

License: Apache License 2.0

Rust 100.00%

bevy_prototype_lyon's Introduction

Bevy + Lyon = ❤

Crates.io Crates.io Downloads GitHub Repo stars CI Bevy tracking

bevy_prototype_lyon enables Bevy users to draw 2D shapes and paths, like triangles, circles, rectangles, lines, arcs and beziers.

Try out the live demo! Regular polygon demo

How does it work?

Currently Bevy does not support drawing custom shapes in an easy way. This crate uses a variation of Bevy's SpriteBundle with custom meshes to draw shapes. The lyon crate is used to generate those custom meshes.

Usage

Add bevy_prototype_lyon to your cargo project:

cargo add bevy_prototype_lyon

Then, you can start by drawing simple shapes:

use bevy::prelude::*;
use bevy_prototype_lyon::prelude::*;

fn main() {
    App::new()
        .insert_resource(Msaa::Sample4)
        .add_plugins(DefaultPlugins)
        .add_plugins(ShapePlugin)
        .add_systems(Startup, setup_system)
        .run();
}

fn setup_system(mut commands: Commands) {
    let shape = shapes::RegularPolygon {
        sides: 6,
        feature: shapes::RegularPolygonFeature::Radius(200.0),
        ..shapes::RegularPolygon::default()
    };

    commands.spawn(Camera2dBundle::default());
    commands.spawn((
        ShapeBundle {
            path: GeometryBuilder::build_as(&shape),
            ..default()
        },
        Fill::color(Color::CYAN),
        Stroke::new(Color::BLACK, 10.0),
    ));
}

Don't forget to check out the examples to learn more!

Bevy versions supported

I strive to support the latest version of Bevy. Support for a version of Bevy is dropped as soon as a new one is released.

The following table shows the latest version of bevy_prototype_lyon that supports a certain version of Bevy.

bevy bevy_prototype_lyon license
0.13 0.11 MIT/Apache 2.0
0.12 0.10 MIT/Apache 2.0
0.11 0.9 MIT/Apache 2.0
0.10 0.8 MIT/Apache 2.0
0.9 0.7 MIT/Apache 2.0
0.8 0.6 MIT/Apache 2.0
0.7 0.5 MIT/Apache 2.0
0.6 0.4 MIT/Apache 2.0
0.5 0.3 MIT
0.4 0.2 MIT

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

bevy_prototype_lyon's People

Contributors

nilirad avatar rparrett avatar theleonsver1 avatar will-hart avatar alyti avatar azorlogh avatar davidb avatar carrascomj avatar nside avatar striezel avatar alec-deason avatar agluszak avatar ssbr avatar schneiderfelipe avatar enaut avatar mockersf avatar shatur avatar jojojet avatar manankarnik avatar wainwrightmark avatar faassen avatar pka avatar weasy666 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.