diff --git a/Cargo.toml b/Cargo.toml index 248f7b5f4624b..5f8aa6a771cba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,6 +114,10 @@ path = "examples/2d/contributors.rs" name = "many_sprites" path = "examples/2d/many_sprites.rs" +[[example]] +name = "rect" +path = "examples/2d/rect.rs" + [[example]] name = "sprite" path = "examples/2d/sprite.rs" diff --git a/examples/2d/rect.rs b/examples/2d/rect.rs new file mode 100644 index 0000000000000..3e93a6d3144e8 --- /dev/null +++ b/examples/2d/rect.rs @@ -0,0 +1,20 @@ +use bevy::prelude::*; + +fn main() { + App::new() + .add_plugins(DefaultPlugins) + .add_startup_system(setup) + .run(); +} + +fn setup(mut commands: Commands) { + commands.spawn_bundle(OrthographicCameraBundle::new_2d()); + commands.spawn_bundle(SpriteBundle { + sprite: Sprite { + color: Color::rgb(0.25, 0.25, 0.75), + custom_size: Some(Vec2::new(50.0, 50.0)), + ..Default::default() + }, + ..Default::default() + }); +} diff --git a/examples/README.md b/examples/README.md index 67506edc2b340..f63b874fcc2e7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -84,6 +84,7 @@ Example | File | Description --- | --- | --- `contributors` | [`2d/contributors.rs`](./2d/contributors.rs) | Displays each contributor as a bouncy bevy-ball! `many_sprites` | [`2d/many_sprites.rs`](./2d/many_sprites.rs) | Displays many sprites in a grid arragement! Used for performance testing. +`rect` | [`2d/rect.rs`](./2d/rect.rs) | Renders a rectangle `sprite` | [`2d/sprite.rs`](./2d/sprite.rs) | Renders a sprite `sprite_sheet` | [`2d/sprite_sheet.rs`](./2d/sprite_sheet.rs) | Renders an animated sprite `text2d` | [`2d/text2d.rs`](./2d/text2d.rs) | Generates text in 2d