mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
23 lines
663 B
Rust
23 lines
663 B
Rust
|
use bevy::{prelude::*, sprite::MaterialMesh2dBundle};
|
||
|
|
||
|
fn main() {
|
||
|
App::new()
|
||
|
.add_plugins(DefaultPlugins)
|
||
|
.add_startup_system(setup)
|
||
|
.run();
|
||
|
}
|
||
|
|
||
|
fn setup(
|
||
|
mut commands: Commands,
|
||
|
mut meshes: ResMut<Assets<Mesh>>,
|
||
|
mut materials: ResMut<Assets<ColorMaterial>>,
|
||
|
) {
|
||
|
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
|
||
|
commands.spawn_bundle(MaterialMesh2dBundle {
|
||
|
mesh: meshes.add(Mesh::from(shape::Quad::default())).into(),
|
||
|
transform: Transform::default().with_scale(Vec3::splat(128.)),
|
||
|
material: materials.add(ColorMaterial::from(Color::PURPLE)),
|
||
|
..Default::default()
|
||
|
});
|
||
|
}
|