Added setup system. Spawns two balls which are rendered correctly.
This commit is contained in:
@@ -1,7 +1,21 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::color::palettes::basic::RED;
|
||||||
|
use bevy::prelude::*; // Core Bevy types
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
|
.add_systems(Startup, setup)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<ColorMaterial>>) {
|
||||||
|
|
||||||
|
commands.spawn(Camera2d);
|
||||||
|
|
||||||
|
let shape =meshes.add(Circle::new(50.0));
|
||||||
|
|
||||||
|
commands.spawn((Mesh2d(shape.clone()), MeshMaterial2d(materials.add(Color::from(RED))), Transform::from_xyz(100.0, 0.0, 0.0)));
|
||||||
|
|
||||||
|
commands.spawn((Mesh2d(shape.clone()), MeshMaterial2d(materials.add(Color::from(RED))), Transform::from_xyz(0.0, 0.0, 0.0)));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user