Compare commits
No commits in common. "f17917ecad6199c7e33b65ea5014538cddff201d" and "26cf4c745314674fb3886409a34a358faf3dd89d" have entirely different histories.
f17917ecad
...
26cf4c7453
1 changed files with 10 additions and 3 deletions
13
src/main.rs
13
src/main.rs
|
@ -60,9 +60,16 @@ fn main() {
|
||||||
.insert_resource(WinitSettings::desktop_app())
|
.insert_resource(WinitSettings::desktop_app())
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
|
.add_systems(Update, rotate_board)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn rotate_board(mut board: Query<&mut Transform, With<Board>>) {
|
||||||
|
let mut board = board.get_single_mut().unwrap();
|
||||||
|
|
||||||
|
board.rotate_local_z(0.1);
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
struct Board;
|
struct Board;
|
||||||
|
|
||||||
|
@ -74,8 +81,8 @@ fn setup(
|
||||||
commands.spawn(Camera2dBundle::default());
|
commands.spawn(Camera2dBundle::default());
|
||||||
|
|
||||||
const TILES: i32 = 9;
|
const TILES: i32 = 9;
|
||||||
const TILE_SIZE: f32 = 5.;
|
const TILE_SIZE: f32 = 50.;
|
||||||
const GAP_SIZE: f32 = 1.;
|
const GAP_SIZE: f32 = 10.;
|
||||||
const TOTAL_WIDTH: f32 = (TILE_SIZE + GAP_SIZE) * TILES as f32;
|
const TOTAL_WIDTH: f32 = (TILE_SIZE + GAP_SIZE) * TILES as f32;
|
||||||
const TILE_SPACE: f32 = TOTAL_WIDTH / TILES as f32;
|
const TILE_SPACE: f32 = TOTAL_WIDTH / TILES as f32;
|
||||||
const OFFSET: f32 = TILE_SPACE / 2.;
|
const OFFSET: f32 = TILE_SPACE / 2.;
|
||||||
|
@ -87,7 +94,7 @@ fn setup(
|
||||||
commands
|
commands
|
||||||
.spawn((
|
.spawn((
|
||||||
SpatialBundle {
|
SpatialBundle {
|
||||||
transform: Transform::from_xyz(0., 0., 0.).with_scale(Vec3::splat(10.)),
|
transform: Transform::from_xyz(0., 0., 0.),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
Board,
|
Board,
|
||||||
|
|
Loading…
Reference in a new issue