Advertisement
443eb9

Untitled

Oct 14th, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.87 KB | None | 0 0
  1. use bevy::core_pipeline::clear_color::ClearColorConfig;
  2. use bevy::prelude::*;
  3. use bevy::sprite::MaterialMesh2dBundle;
  4.  
  5. #[test]
  6. fn main() {
  7.     println!("Hello, world!");
  8.     App::new()
  9.         .add_plugins(DefaultPlugins)
  10.         .add_systems(Startup, setup)
  11.         .run();
  12. }
  13.  
  14. fn setup(
  15.     mut commands: Commands,
  16.     mut meshes: ResMut<Assets<Mesh>>,
  17.     mut materials: ResMut<Assets<ColorMaterial>>,
  18. ) {
  19.     commands.spawn(Camera2dBundle {
  20.         camera_2d: Camera2d {
  21.             clear_color: ClearColorConfig::Custom(Color::BLACK),
  22.         },
  23.         ..default()
  24.     });
  25.  
  26.     commands.spawn(MaterialMesh2dBundle {
  27.         mesh: meshes.add(shape::Circle::new(50.0).into()).into(),
  28.         material: materials.add(ColorMaterial::from(Color::PURPLE)),
  29.         transform: Transform::from_translation(Vec3::new(0.0, 0.0, 0.0)),
  30.         ..default()
  31.     });
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement