12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- use bevy::prelude::*;
- use bevy_mod_picking::*;
- mod pieces;
- use pieces::*;
- mod board;
- use board::*;
- fn main() {
- App::build()
- // antialiasing at 4 samples
- .insert_resource(Msaa { samples: 4})
- // change title and size of window
- .insert_resource(WindowDescriptor {
- title: "Chess!".to_string(),
- width: 1600.0,
- height: 1000.0,
- ..Default::default()
- })
- .add_plugins(DefaultPlugins)
- .add_plugin(PickingPlugin)
- .add_plugin(BoardPlugin)
- .add_startup_system(setup.system())
- .add_startup_system(create_pieces.system())
- .run();
- }
- fn setup(
- mut commands: Commands,
- mut meshes: ResMut<Assets<Mesh>>,
- mut materials: ResMut<Assets<StandardMaterial>>,
- ) {
- // Camera
- commands.spawn_bundle(PerspectiveCameraBundle {
- transform: Transform::from_matrix(Mat4::from_rotation_translation(
- Quat::from_xyzw(-0.3, -0.5, -0.3, 0.5).normalize(),
- Vec3::new(-7.0, 20.0, 4.0),
- )),
- ..Default::default()
- })
- .insert_bundle(PickingCameraBundle::default());
- // Light
- commands.spawn_bundle(LightBundle {
- transform: Transform::from_translation(Vec3::new(4.0, 8.0, 4.0)),
- ..Default::default()
- });
- }
|